Skip to content

Instantly share code, notes, and snippets.

@qrush
qrush / gist:5301799
Created April 3, 2013 14:41
spring clean your git repos!
# remove any bad refs
git remote prune origin
# pipe into bash and auto-delete any branches that have been merged into master!
git log master --pretty=format:'%d' | grep '^ (origin' | tr -d ' ()' | sed 's/origin\//git push origin :/'
@Gazler
Gazler / setup.sh
Last active February 13, 2024 10:30
sysctl -w fs.file-max=12000500
sysctl -w fs.nr_open=20000500
ulimit -n 4000000
sysctl -w net.ipv4.tcp_mem='10000000 10000000 10000000'
sysctl -w net.ipv4.tcp_rmem='1024 4096 16384'
sysctl -w net.ipv4.tcp_wmem='1024 4096 16384'
sysctl -w net.core.rmem_max=16384
sysctl -w net.core.wmem_max=16384
wget http://packages.erlang-solutions.com/erlang-solutions_1.0_all.deb
sudo dpkg -i erlang-solutions_1.0_all.deb
@jfreeze
jfreeze / tailwindsetup.txt
Last active July 15, 2022 17:54
TailwindCSS Setup
mix phx.new app_name
cd app_name
cd assets
npm install tailwindcss @tailwindcss/ui postcss-import postcss-loader --save-dev
npx tailwindcss init
npx tailwind init tailwindcss-full.js --full
# Change the app dir to your app dir!
@myobie
myobie / mountain-lion-brew-setup.markdown
Created February 18, 2012 20:14
Get Mountain Lion and Homebrew to Be Happy

Get Mountain Lion and Homebrew to Be Happy

1) Install XCode 4.4 into /Applications

Get it from the App Store.

2) Install Command Line Tools

In XCode's Preferences > Downloads you can install command line tools.

@rednaxelafx
rednaxelafx / prettyprint.js
Created January 20, 2011 03:03
Pretty print JavaScript objects (does not conform to JSON, because we don't want escape sequences in string literals)
function isPlainObject(o) {
return o && toString.call(o) === '[object Object]' && 'isPrototypeOf' in o;
}
function isArray(o) {
return toString.call(o) == '[object Array]';
}
function objectToString(val) {
var INDENT = '  ';
@eoinkelly
eoinkelly / postgres-upgrade-recipe.sh
Last active November 9, 2017 16:59
Upgrade Postgres to 9.4 using Homebrew on Mac OSX
#!/bin/bash
# This script can be used in "run & hope" mode or you can use it as a recipe to
# do things manually - you probably want the latter if you really care about
# the data in your databases.
# Happy hacking
# /Eoin/
# Tell bash to stop if something goes wrong
set -e
@cromwellryan
cromwellryan / Guardfile
Last active December 19, 2015 08:19
Guardfile for elixirc
guard 'shell', :elixirc_bin => "/usr/local/elixirc" do
watch(/(.+\.ex$)/) { |m| `elixirc #{m[0]}` }
end
guard 'shell', :elixir_bin => "/usr/local/elixir" do
watch(/(.+\.exs$)/) { |m| `elixir #{m[0]}` }
end
# config/initializers/delayed_job_mongoid.rb
module Delayed
module Backend
module ActiveRecord
class Job < ::ActiveRecord::Base
def self.before_fork
::ActiveRecord::Base.clear_all_connections!
::Mongoid.master.connection.close
end
(defun tester (&rest cl-keys)
(cl--parsing-keywords ((:function nil) (:match nil)) nil
(if (and buffer-file-name (string-match cl-match buffer-file-name))
(setq tester--test-run-function cl-function)
(setq tester--test-run-function nil))))
(defun tester--store-setup ()
(setq tester--last-test-file buffer-file-name)
(setq tester--last-test-function tester--test-run-function))
@chrismccord
chrismccord / gist:e774e6ab5220e6505a03
Last active August 29, 2015 14:10
Upgrading your Phoenix 0.5.x application to 0.6.0

Upgrading Phoenix 0.5.x to 0.6.0

If you're still on 0.4.x, follow [this 0.4x to 0.5.0 upgrade guide] (http://learnelixir.com/blog/2014/10/29/migrating-applications-from-phoenix-0-dot-4-1-to-phoenix-0-dot-5-0/), then head back over here.

Phoenix 0.6.0 brings some nice enhancements and a few backwards incompatible changes. The following steps should get your 0.5.x apps up and running on the latest and greatest.

Router

The Router no longer defines the default :browser and :api pipelines for you, but they remain the idiomatic defaults. You can copy the standard pipelines into your router: