Creează un cont pentru a te abona la acest blog și a-i urmări articolele pe pagina Lectură.
-
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.
-
In your AWS Console, select the Bucket that you’re trying to make public.
-
Logging is important.
-
Setting up a confirmation box can be quite tricky, here’s how to quickly get a confirmation box setup in AngularJS.
-
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…
-
[Update 2026]: Back when I wrote this, getting a Jekyll site live on your own server was a pain.
-
Something that I’ve just found out recently.
-
Today’s post is going to be a pretty short one.
-
Generating PDF for your webapplication is not that difficult as you think.
-
Need a quick way to serve html files?
-
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…
-
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…
-
If you’re using pagekite, you probably have read this document.
-
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…
-
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?
-
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…
-
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.
-
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…
-
When writing a method that requires a custom request header, ie.
-
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…
-
I’m starting to do all my development remotely on a development server that I’m hosting at home over a VPN.
-
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.
-
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.
-
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…
-
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.
-
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 .
-
Multithreading is nothing new in Ruby but its only in recent times that I’ve found a use for it.
-
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…
-
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.
-
Start testing your REST API in RSpec.
-
Over the weekend, I was trying to experiment with some SD card images for the UDOO Board.
-
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.
-
#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,…
-
Woohoo, got the Adafruit PiTFT working on our Raspberry Pis.
-
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> $
-
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.
-
With just: array.inject(:+) It will take an array and sum it up. >> [0,2,3,1] >> [0,2,3,1].inject(:+) => 6
-
TIL file uploads over Rack (multipart form upload) stores the files with a tmp filename.
-
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…
-
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.
-
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.
-
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.
-
#TIL in more detail how networked devices auto expose their listening ports to the external world without any user interaction on their routers.
-
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…
-
Ever get problems with your Vagrant informing you that your Virtualbox Guest Additions is of a different version than your Virtualbox version?
-
So I’ve been having this irritating problem of configuring wifi on my small mini-computers in command-line.
-
Quick tip: If you’re planning to run Monkey httpd on Raspbian, don’t use the official Raspbian repository to pull the package.
-
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…
-
So I was helping out a friend figure out why his server keeps crashing and timing out.
-
If you’re using Vagrant, this is the Vagrant Box I’ve been using that has been really awesome.