Skip to content

Instantly share code, notes, and snippets.

View 0_curly_braces_vs_do_end.rb
# > Note 1: Yes, the parenthesis `( )`` for the prepend call are required when
# > using this inline style. If you do not use the parenthesis it will fail
# > silently and the patch will not be applied.
# --
# The code below will show what's happening in this line of code from the blog:
# prepend(KaminariFix = do
# ...
# end)
pixeltrix /
Last active Feb 25, 2021
When should you use DateTime and when should you use Time?

When should you use DateTime and when should you use Time?

It's a common misconception that [William Shakespeare][1] and [Miguel de Cervantes][2] died on the same day in history - so much so that UNESCO named April 23 as [World Book Day because of this fact][3]. However because England hadn't yet adopted [Gregorian Calendar Reform][4] (and wouldn't until [1752][5]) their deaths are actually 10 days apart. Since Ruby's Time class implements a [proleptic Gregorian calendar][6] and has no concept of calendar reform then there's no way to express this. This is where DateTime steps in:

>> shakespeare = DateTime.iso8601('1616-04-23', Date::ENGLAND)
=> Tue, 23 Apr 1616 00:00:00 +0000
>> cervantes = DateTime.iso8601('1616-04-23', Date::ITALY)
=> Sat, 23 Apr 1616 00:00:00 +0000
rstormsf /
Last active Jan 29, 2018
Bedrock ansible setup
#Script to install Bedrock Wordpress stack on OSX
brew doctor
brew tap caskroom/cask
brew update && brew upgrade brew-cask && brew cleanup && brew cask cleanup
brew cask install virtualbox vagrant
brew install rbenv ruby-build
#use bashrc if you are not on zsh
cat >> ~/.zshrc << EOF
# ###
markjaquith / nginx.conf
Last active Sep 22, 2020
My WordPress Nginx setup
View nginx.conf
upstream phpfpm {
server unix:/var/run/php5-fpm.sock;
upstream hhvm {
server unix:/var/run/hhvm/hhvm.sock;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
bennylope / ansible.yml
Created Apr 30, 2014
Deployment w/ Capistrano style deployments with Ansible & Capistrano
View ansible.yml
- name: Deploy new site release
user: deployer
hosts: all
- name: Fetch repo updates
git: >
magnetikonline /
Last active Apr 1, 2021
Setting Nginx FastCGI response buffer sizes.
nicolai86 / ansible-rails example
Created Feb 12, 2014
a current usage example for nicolai86.rails-deployment as of v0.6.0
View ansible-rails example
- hosts: server
user: app_user
gather_facts: False
user: app_user
home_directory: "/home/{{ user }}"
deploy_to: "{{ home_directory }}/app"
ftrain / rhymes.clj
Last active Jan 4, 2021
Annotated rhyming dictionary
View rhymes.clj
;; This is at:
;; So we want a rhyming dictionary in Clojure. Jack Rusher put up
;; this code here:
;; I'm going to study this code and learn as I go.
;; First I put it in a namespace.
joelhooks /
Last active Dec 20, 2020
Podcasting Gear List
sjl / zl.vim
Created Jan 17, 2014
Zip Right Vim mapping
View zl.vim
" Zip Right
" Moves the character under the cursor to the end of the line. Handy when you
" have something like:
" foo
" And you want to wrap it in a method call, so you type:
" println()foo