← Înapoi la Urmăritori

Cel mai recent articol

Ultima verificare

Urmăritori 0 urmăritori
Articole: 200
  1. Background: Say you have controller method that creates and writes into a file and you’d like to be able to run expectations on the behavior and not so much of the implementation.

  2. How to make a S3 bucket publicly accessible

    In your AWS Console, select the Bucket that you’re trying to make public.

  3. How to setup Fluentd to Log to S3 with Rails

    Logging is important.

  4. Setting up a confirmation box can be quite tricky, here’s how to quickly get a confirmation box setup in AngularJS.

  5. If you’re running a Rails 4.x app with AngularJS, and you’re getting increasingly frustrated with receiving “AngularJS loaded twice” errors and you can’t seem to figure out what went wrong, perhaps you might want to make sure you do two things first: Firs…

  6. [Update 2026]: Back when I wrote this, getting a Jekyll site live on your own server was a pain.

  7. Something that I’ve just found out recently.

  8. Today’s post is going to be a pretty short one.

  9. Generating PDF for your webapplication is not that difficult as you think.

  10. Need a quick way to serve html files?

  11. Figure out which DNS server you are using

    If you need to find out what DNS you are currently using (for troubleshooting purposes, this snippet might help): $ tcpdump udp and src port 53 $ tcpdump udp and dst port 53 $ tcpdump -n -s 1500 -i eth0 udp port 53 These 3 commands will sniff your packets…

  12. If you’re running GNOME and you have a custom script/app that you want to be able to run quickly from your applications bar, you can easily add an entry with the following: In your ~/.local/share/applications or /usr/share/applications folder (choose one…

  13. Authenticating with Pagekite API using Ruby

    If you’re using pagekite, you probably have read this document.

  14. MySQL backup process

    How I usually prepare the backup regime of my mysql/mariadb databases of all my newly provisioned servers is to do the following tasks: Create a DBA user > create user 'dba'@'localhost'; Give the DBA user only the relevant access just for backing > GRANT…

  15. In ActiveRecord, when working with legacy database and the existing database uses different fields for last_update and created_at, how do you specify the correct column names for ActiveRecord to properly record timestamps?

  16. Equivalent of try() for hashes? - Ruby

    To do a try() on hashes, its as simple as: # to get data['something_value'] @item = @model.try(:data).try(:[], 'something_value'] 2021 Update From ruby 2.3.0 you can now do the following shorthand @model&.data&.[](:something_value) Reference: Safe navigat…

  17. Migrating from utf8 to utf8mb4 in MySQL

    If you ever get this error message: Incorrect string value: '\xF0\x90\x8D\x83\xF0\x90...' for column 'content' at row You probably have experienced at one point, the horrors that is mysql’s utf8 4-byte encoding.

  18. When testing for mailers, you might need to add the following quite frequently: describe "test mailer" do it "should work" do ActionMailer::Base.deliveries.clear # bunch of other # codes here end end You probably would add them at the start of every test…

  19. Testing with Rack-test custom headers

    When writing a method that requires a custom request header, ie.

  20. Things to do with a new Ubuntu Installation

    This post will be constantly updating for new information Step 1: Setup Swap space sudo /bin/dd if=/dev/zero of=/var/swap.1 bs=1M count=2048 # count is in MB sudo /sbin/mkswap /var/swap.1 sudo /sbin/swapon /var/swap.1 Setup 2:Setup IPv4 Precedence To ensu…

  21. X11 forwarding over remote SSH tmux

    I’m starting to do all my development remotely on a development server that I’m hosting at home over a VPN.

  22. Yeah, I’m probably pretty slow in the game but I think I’ve finally wrapped my head around all the countless Rack Middlewares out there.

  23. Creating a custom jekyll-markdown snippet

    In the time spent writing the previous blog post, I come to realize that I really need a snippet to help me with the highlight tags.

  24. Stub a Rails Environment in RSpec

    When writing tests to test for rails.env specific functions, in order to temporarily change the rails environment during testing, use this: Rails.stub(env: ActiveSupport::StringInquirer.new("production")) This will then pass when doing a Rails.env.product…

  25. If you’re like me and you’ve already set: passenger_pre_start http://somesite_to_load/; But yet your application doesn’t load up on restart.

  26. Add leading zeroes in Ruby

    To add leading zeroes infront of a number in ruby, try this: # with 5 being the number you want to have the leading zeroes added to irb> "%03d" % 5 => 005 # 3 leading 0 digits with number 5 .

  27. Ruby Multithreading with Threadwait

    Multithreading is nothing new in Ruby but its only in recent times that I’ve found a use for it.

  28. User Agent Testing in Rack/Test

    When using Rack::Test, to mock out the user-agent of the request, do something like: get "/activate/", {}, {'HTTP_USER_AGENT' => "Mozilla/5.0 (iPhone; CPU iPhone OS 7_0_2 like Mac OS X) AppleWebKit/537.51.1 (KHTML, like Gecko) Mobile/11A501 Twitter for iP…

  29. So sometimes in the midst of trying to find out what’s went wrong with our mysql query and why is it so slow, we enable mysql slow query log.

  30. Include Rack/Test to perform API Testing

    Start testing your REST API in RSpec.

  31. Over the weekend, I was trying to experiment with some SD card images for the UDOO Board.

  32. Access your Raspberry Pi/UDOO via Serial

    Learnt today that it is possible to have a direct output from most minipc boards w/o having to ssh in and dmesg, or hook up another monitor to it, just to find out what’s going on.

  33. Format strings dynamically in ruby

    #TIL you can format strings dynamically and neatly with: puts "%s is at %s" % [ 'John', 'Singapore' ] => John is at Singapore 2021 Update The above is similar to how we do it in go person := "John" country := "Singapore" fmt.Printf("%s is at %s", person,…

  34. Got the Adafruit PiTFT Working

    Woohoo, got the Adafruit PiTFT working on our Raspberry Pis.

  35. SSH Portforwarding

    When having a remote computer (A) in which you’re trying to access the port :3000, you can setup a reverse portforwarding with the following command: $ ssh -L <port that you want to access locally>:localhost:<port that you want to connect to> <user>@<ip> $

  36. If you’re like me, using carrierwave + fog to hook up your Model witih Amazon S3, you may encounter this problem where you need to reprocess an image and you can’t do so without downloading the file locally.

  37. Sum up array contents with a simple method

    With just: array.inject(:+) It will take an array and sum it up. >> [0,2,3,1] >> [0,2,3,1].inject(:+) => 6

  38. Rack Multipart HTTP upload

    TIL file uploads over Rack (multipart form upload) stores the files with a tmp filename.

  39. Add text to end of multiple line - vim

    Suppose you have a whole list of text: Movies Travel Fashion (Men) Fashion (Women) Education Technology Clubbing Nightlife Fine Dining Food E-Commerce Beauty Wellness Gaming Performing Arts Sports Books Music Photography Fitness Gadgets And you want to ma…

  40. Better Errors not working over Vagrant

    If you’re running the awesome better_errors over a vagrant environment and you’re wondering why on earth isn’t better_errors intercepting your exceptions.

  41. Facebook OAuth doesnt support local testing

    If you’re like me, trying to setup a Facebook App for a Website Oauth and having the redirect_uri set to “http://localhost:3000”, don’t bother.

  42. Dotenv is one of those few gems which provide an easy way for dev. teams to properly and (at least semi)-securely manage their application environments.

  43. UPNP IGP

    #TIL in more detail how networked devices auto expose their listening ports to the external world without any user interaction on their routers.

  44. Quick note that I’ve discovered when working with full-screen background images not sizing up itself properly in portrait mode on Android’s Chrome. html { background: asset-url('supercoolbackground.jpg', image) no-repeat center center fixed; -webkit-backg…

  45. Fix VB Guest Addition update error in Vagrant

    Ever get problems with your Vagrant informing you that your Virtualbox Guest Additions is of a different version than your Virtualbox version?

  46. Wifi Configuration - Ncurses style

    So I’ve been having this irritating problem of configuring wifi on my small mini-computers in command-line.

  47. Monkey HTTP for Raspbian

    Quick tip: If you’re planning to run Monkey httpd on Raspbian, don’t use the official Raspbian repository to pull the package.

  48. Exclude individual css from assets pipeline

    When in the need to remove certain CSS files from your application.css’s require_tree: # application.css /* *= require_self *= require_tree . */ Use sprocket’s stub directive: # application.css /* *= require_self *= require_tree . *= stub whatevercssyoudo…

  49. Mongodb caveats; you need swap space

    So I was helping out a friend figure out why his server keeps crashing and timing out.

  50. Vagrant for Ruby and ROR developers

    If you’re using Vagrant, this is the Vagrant Box I’ve been using that has been really awesome.