Skip to content

Instantly share code, notes, and snippets.

View justincase's full-sized avatar

Justin Case justincase

View GitHub Profile

Keybase proof

I hereby claim:

  • I am justincase on github.
  • I am justincase (https://keybase.io/justincase) on keybase.
  • I have a public key whose fingerprint is 1E8D B329 E2B1 1B72 427B CCE0 9A47 4C09 80A9 FECB

To claim this, I am signing this object:

@justincase
justincase / DOCS.asciidoc
Created February 15, 2015 20:15
minimum master nodes

The minimum_master_nodes setting is extremely important to the stability of your cluster. This setting helps prevent split brains, the existence of two masters in a single cluster.

When you have a split brain, your cluster is at danger of losing data. Because the master is considered the supreme ruler of the cluster, it decides when new indices can be created, how shards are moved, and so forth. If you have two masters, data integrity becomes perilous, since you have two nodes

@justincase
justincase / comment
Created April 15, 2015 23:44
Fix "Failed to enable crypto" on php56
# https://github.com/composer/composer/issues/2798
# Failed to enable crypto
grafhax commented on Dec 3, 2014
I've encountered this problem when setting up new dev environments on my mac. To solve the issue i've had to make sure the php-curl library was compiled with php and updated. I generally do this using MacPorts to manage/compile the libs.
# update the ports tree (software list)
$ sudo port -v selfupdate
# install php (shortcut for compiling php with our required libs)
$ sudo port install php56
@justincase
justincase / Result
Created December 31, 2008 05:35 — forked from flavorjones/Result
XML Document parsing benchmark
user system total real
hpricot:xml:doc 10.160000 0.950000 11.110000 ( 11.144462)
hpricot2:xml:doc 0.950000 0.000000 0.950000 ( 0.953266)
nokogiri:compat:doc 0.220000 0.020000 0.240000 ( 0.238401)
nokogiri:xml:doc 0.170000 0.030000 0.200000 ( 0.200283)
XML XPath benchmarks (//status/text, //user/name)
user system total real
hpricot:xml:xpath 7.580000 1.150000 8.730000 ( 8.728314)

GitHub Javascript Strategy

Unless otherwise necessary (such as mobile development), the GitHub javascript codebase is based off jQuery. You can safely assume it will be included on every page.

File naming

  • All jquery plugins should be prefixed with jquery, such as jquery.facebox
  • All github-specific jquery plugins should be prefixed with jquery.github. Like jquery.github.repo_list.js
  • All page-specific files (that only run on ONE page) should be prefixed with page. page.billing.js
@justincase
justincase / gist:850966
Created March 2, 2011 13:59
Set terminal title

Change terminal (tab) title to something meaningful instead of just 'ruby'

system("printf \"\033]0;Rails\007\"")
require 'net/http'
require 'net/https'
require 'openssl'
url = URI.parse("https://github.com/") # OK
#url = URI.parse("https://etutorials.org/") # Hostname mismatch
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_PEER
@justincase
justincase / gist:871758
Created March 15, 2011 23:58
Net HTTPS without callback
require 'net/http'
require 'net/https'
require 'uri'
url = URI.parse("https://github.com/") # OK
#url = URI.parse("https://etutorials.org/") # Hostname mismatch
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_PEER
request = Net::HTTP::Get.new(url.path)
?attempt=&filename=nope
@justincase
justincase / gist:4690368
Created February 1, 2013 09:36
BCrypt's 72 char limit
require 'bcrypt'
char71 = "a" * 71
char72 = char71 + "b"
BCrypt::Password.create(char71) == char72 # => false
char72 = "a" * 72
char73 = char72 + "b"