Skip to content

Instantly share code, notes, and snippets.

View mereformalities's full-sized avatar

Brant Watrous mereformalities

View GitHub Profile
@imjakechapman
imjakechapman / gulpfile.js
Last active August 29, 2015 13:56
My personal base Gulpfile
// Gulp Requires
var gulp = require('gulp'),
gutil = require('gulp-util'),
uglify = require('gulp-uglify'),
notify = require('gulp-notify'),
sass = require('gulp-sass'),
livereload = require('gulp-livereload'),
rjs = require('gulp-requirejs');
// Node requires for exec and sys
@runlevel5
runlevel5 / puma.sh
Last active July 18, 2022 17:37
pumactl is very broken, @nemshilov and @joneslee85 wrote this bash script replacement and it works so reliably on production server. So here it is, share with the world!
#!/usr/bin/env bash
# Simple move this file into your Rails `script` folder. Also make sure you `chmod +x puma.sh`.
# Please modify the CONSTANT variables to fit your configurations.
# The script will start with config set by $PUMA_CONFIG_FILE by default
PUMA_CONFIG_FILE=config/puma.rb
PUMA_PID_FILE=tmp/pids/puma.pid
PUMA_SOCKET=tmp/sockets/puma.sock
@flarik
flarik / dot.powrc.sh
Created June 12, 2013 10:25
Pow's .porwrc config file for use with RVM's config files .rvmrc or .ruby-version (+ optional .ruby-gemset)
if [ -f "${rvm_path}/scripts/rvm" ]; then
source "${rvm_path}/scripts/rvm"
if [ -f ".rvmrc" ]; then
source ".rvmrc"
elif [ -f ".ruby-version" ] && [ -f ".ruby-gemset" ]; then
rvm use `cat .ruby-version`@`cat .ruby-gemset`
elif [ -f ".ruby-version" ]; then
rvm use `cat .ruby-version`
@mattscilipoti
mattscilipoti / postgres.rake
Last active May 1, 2019 18:42
rake db:kill_postgres_connections
puts "WARN: We are patching rake tasks to support postgres. You have upgraded Rails and may not need this patch any more (lib/tasks/postgres.rake)." if Rails.version > "3.2.8"
namespace :db do
desc 'kills connections to postgres db'
task :kill_postgres_connections => :environment do
env = ENV['RAILS_ENV']
db_config = Rails.configuration.database_configuration[env]
fail(ArgumentError, "Could not find db config entry for env (#{env})") unless db_config
db_name = db_config['database']
@mikhailov
mikhailov / 0. nginx_setup.sh
Last active June 29, 2024 23:43
NGINX+SPDY with Unicorn. True Zero-Downtime unless migrations. Best practices.
# Nginx+Unicorn best-practices congifuration guide. Heartbleed fixed.
# We use latest stable nginx with fresh **openssl**, **zlib** and **pcre** dependencies.
# Some extra handy modules to use: --with-http_stub_status_module --with-http_gzip_static_module
#
# Deployment structure
#
# SERVER:
# /etc/init.d/nginx (1. nginx)
# /home/app/public_html/app_production/current (Capistrano directory)
#
@hennk
hennk / Assetfile.rb
Created May 28, 2012 11:54
rake pipeline configuration, memory leak
APPNAME = 'liquid_editor'
require 'rake-pipeline-web-filters'
require File.join(File.dirname(__FILE__), 'support/ember_strip_debug_filter/ember_strip_debug_filter')
require File.join(File.dirname(__FILE__), 'support/precompiling_handlebars_filter/precompiling_handlebars_filter')
SHOULD_UGLIFY = ENV['RAKEP_MODE'] == 'production'
output (ENV['LIQUID_EDITOR_ASSETS_OUTPUT'] || 'assets')
@zilkey
zilkey / ember-precompile.js
Created March 10, 2012 22:30 — forked from garth/Jakefile.js
Precompile .handlebars templates with node js
var fs = require('fs');
var vm = require('vm');
var emberjs = fs.readFileSync('public/javascripts/vendor/ember-0.9.5.min.js', 'utf8');
var templatesDir = 'templates';
var destinationDir = 'public/javascripts/templates';
function compileHandlebarsTemplate(templatesDir, fileName) {
var file = templatesDir + '/' + fileName;
@mikeobrien
mikeobrien / app.coffee
Created February 21, 2012 04:49
Lazy loading backbone collection + infinite scrolling
class LazyCollection extends Backbone.Collection
indexQuerystring: 'index'
index: 1
lastLength: 0
fetch: (options) ->
options or= {}
if options.reset
@index = 1
@lastLength = 0
else
@petervandenabeele
petervandenabeele / gist:1722491
Created February 2, 2012 09:10
rails new (with 3.2.1 in a fresh gemset)
$ rvm install ruby-1.9.3
Already installed ruby-1.9.3-p0.
To reinstall use:
rvm reinstall ruby-1.9.3-p0
$ rvm use 1.9.3
Using /home/peterv/.rvm/gems/ruby-1.9.3-p0
@larscwallin
larscwallin / jquery.elementFromPoint
Created December 28, 2011 16:35
jquery.elementFromPoint
(function ($){
var check=false, isRelative=true;
$.elementFromPoint = function(x,y)
{
if(!document.elementFromPoint) return null;
if(!check)
{
var sl;