Skip to content

Instantly share code, notes, and snippets.

View njt1982's full-sized avatar
Converting Coffee into Code

Nicholas Thompson njt1982

Converting Coffee into Code
View GitHub Profile
@q0rban
q0rban / jgd_pull_request_builder.sh
Created December 7, 2012 20:53
Example Job for Jenkins Github Drupal Pull Request Builder
#!/usr/bin/env bash
set -e
# Jenkins job script for use with the Jenkins Github Drupal, which can be found
# at https://github.com/Lullabot/jenkins_github_drupal. NOTE, all shell scripts
# have been symlinked to /usr/local/bin to make them easier to call here. For
# example:
# ln -s /usr/local/share/jenkins_github_drupal/prepare_dir.sh \
# /usr/local/bin/jgd-prepare-dir
@kg
kg / decodeFloat.js
Created March 25, 2012 10:53
Decode 32/64-bit float from bytes in JavaScript
// Derived from http://stackoverflow.com/a/8545403/106786
function decodeFloat(bytes, signBits, exponentBits, fractionBits, eMin, eMax, littleEndian) {
var totalBits = (signBits + exponentBits + fractionBits);
var binary = "";
for (var i = 0, l = bytes.length; i < l; i++) {
var bits = bytes[i].toString(2);
while (bits.length < 8)
bits = "0" + bits;
@them0nk
them0nk / rspec_rails_cheetsheet.rb
Created March 23, 2012 03:39
Rspec Rails cheatsheet (include capybara matchers)
#Model
@user.should have(1).error_on(:username) # Checks whether there is an error in username
@user.errors[:username].should include("can't be blank") # check for the error message
#Rendering
response.should render_template(:index)
#Redirecting
response.should redirect_to(movies_path)
@prellele
prellele / gist:1825744
Created February 14, 2012 10:48
Using StartSSL Certs with Nginx-Webserver

NOTE: You can check, if your config here:
http://www.sslshopper.com/ssl-checker.html

Decrypt the private key using the password you entered when you created your key:
openssl rsa -in ssl.key -out /etc/nginx/conf/ssl.key

Protect your key from prying eyes:
chmod 600 /etc/nginx/conf/ssl.key