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
@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

@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)
@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;
@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
@q0rban
q0rban / jenkins_log_parser_drush
Created December 7, 2012 21:04
Jenkins Drush Log Parser rules
warning /\[warning\]/
error /\[error\]/
info /\[completed\]/
info /\[success\]/
info /\[ok\]/
error /Processed 0/
@cobyism
cobyism / gh-pages-deploy.md
Last active May 25, 2024 08:30
Deploy to `gh-pages` from a `dist` folder on the master branch. Useful for use with [yeoman](http://yeoman.io).

Deploying a subfolder to GitHub Pages

Sometimes you want to have a subdirectory on the master branch be the root directory of a repository’s gh-pages branch. This is useful for things like sites developed with Yeoman, or if you have a Jekyll site contained in the master branch alongside the rest of your code.

For the sake of this example, let’s pretend the subfolder containing your site is named dist.

Step 1

Remove the dist directory from the project’s .gitignore file (it’s ignored by default by Yeoman).

@juampynr
juampynr / mymodule.info
Last active June 9, 2023 21:53
Drupal 7 Views 3 custom field handler
dependencies[] = ctools
; Views Handlers
files[] = views/mymodule_handler_handlername.inc
@q0rban
q0rban / pull-requests
Last active December 20, 2015 13:59
Nginx Pull Requests config
server {
listen 0.0.0.0:80;
# Sniffs for domains of the format
# pr.[project-id].[pull-request-id].example.com, e.g.
# pr.lullabot_com.387.example.com. The project id must be only alphanumeric
# and underscores or hyphens.
server_name ~^pr\.(?<project>[a-zA-Z_-]*)\.(?<pull_request_id>[0-9]*)\.example\.com$;
## Access and error logs.
access_log /var/log/nginx/pr.$project.access.log;
@njt1982
njt1982 / nginx configure
Created September 11, 2013 09:03
My nginx configuration
./configure --user=nginx --group=nginx --prefix=/usr/share/nginx --sbin-path=/usr/sbin/nginx --conf-path=/etc/nginx/nginx.conf --error-log-path=/var/log/nginx/error.log --http-log-path=/var/log/nginx/access.log --http-client-body-temp-path=/var/lib/nginx/tmp/client_body --http-proxy-temp-path=/var/lib/nginx/tmp/proxy --http-fastcgi-temp-path=/var/lib/nginx/tmp/fastcgi --http-uwsgi-temp-path=/var/lib/nginx/tmp/uwsgi --http-scgi-temp-path=/var/lib/nginx/tmp/scgi --pid-path=/var/run/nginx.pid --lock-path=/var/lock/subsys/nginx --with-openssl=/usr/local/src/openssl-0.9.8l/ --with-openssl-opt="enable-tlsext" --with-http_ssl_module --with-http_realip_module --with-http_addition_module --with-http_geoip_module --with-http_sub_module --with-http_gzip_static_module --with-http_stub_status_module --with-http_perl_module --with-file-aio --with-cc-opt='-O2 -g -pipe -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic' --with-ld-opt=-Wl,-E
@wsargent
wsargent / docker_cheat.md
Last active August 31, 2023 12:10
Docker cheat sheet