Skip to content

Instantly share code, notes, and snippets.

@justinhillsjohnson
justinhillsjohnson / sitemap.liquid
Created February 24, 2015 16:05
locomotivecms-sitemap-liquid
---
title: Sitemap
slug: sitemap
is_layout: false
listed: false
published: true
cache_strategy: none
response_type: text/xml
position: 1
---
@tonycoco
tonycoco / active_admin.js
Last active July 15, 2017 18:34
Array of Hashes input for ActiveAdmin and Formtastic
$('.array-of-hashes-tables').on('click', '.array-of-hashes-table .remove', function(event) {
event.preventDefault();
$(this).closest('.array-of-hashes-table').remove();
});
$('.array_of_hashes .add').on('click', function(event) {
event.preventDefault();
var $this = $(this);
var $tables = $this.siblings('.array-of-hashes-tables');
var $cloneable = $tables.find('.cloneable').first();
@tsl0922
tsl0922 / .tmux.conf
Last active September 18, 2024 23:17
vim style tmux config
# vim style tmux config
# use C-a, since it's on the home row and easier to hit than C-b
set-option -g prefix C-a
unbind-key C-a
bind-key C-a send-prefix
set -g base-index 1
# Easy config reload
bind-key R source-file ~/.tmux.conf \; display-message "tmux.conf reloaded."
@tomchentw
tomchentw / comment_policy.rb
Created January 23, 2014 14:42
Implementation of ActiveAdmin::PunditAdapter and usage of Pundit with ActiveAdmin. A PR is opened here : https://github.com/gregbell/active_admin/pull/2857
# app/policies/active_admin/
module ActiveAdmin
class CommentPolicy < ApplicationPolicy
class Scope < Struct.new(:user, :scope)
def resolve
scope
end
end
end
end
@dreamcat4
dreamcat4 / macmini 1,1 to 2,1 EFI firmware update
Last active September 4, 2024 21:12
macmini 1,1 to 2,1 EFI firmware update
Guide & Discussion Thread:
http://forum.netkas.org/index.php?topic=874.0
http://forum.netkas.org/index.php?action=printpage;topic=874.0
For the best guide, use search keyword: chmod. Scrolls down to -->
Post by: Shinso on September 18, 2012, 07:28:35 PM
Post by: Shinso on September 18, 2012, 07:30:19 PM
* First: upgrade cpu to Core2Duo
@masonforest
masonforest / gist:4048732
Created November 9, 2012 22:28
Installing a Gem on Heroku from a Private GitHub Repo

Installing a Gem on Heroku from a Private GitHub Repo

Sometimes you want to use a gem on Heroku that is in a private repository on GitHub.

Using git over http you can authenticate to GitHub using basic authentication. However, we don't want to embed usernames and passwords in Gemfiles. Instead, we can use authentication tokens.

  1. Get an OAuth Token from GitHub

First you will need to get an OAuth Token from GitHub using your own username and "note"

@MohamedAlaa
MohamedAlaa / tmux-cheatsheet.markdown
Last active September 22, 2024 08:03
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
@r10r
r10r / skitch2png.rb
Created May 29, 2012 06:11
Extract PNG data from .skitch SVG files
#!/usr/bin/env ruby
# extracts the embedded PNG data from .skitch SVG files
require 'nokogiri'
require 'base64'
IMAGE_HEADER = "data:image/png;base64,"
ARGV.each do |filename|
svg_document = Nokogiri::XML(File.open(filename))
@eparreno
eparreno / gist:1845561
Created February 16, 2012 15:17
Install libmagic on Mac OS X via homebrew
$ brew install libmagic
$ brew link libmagic (if the link is already created is going to fail, don't worry about that)
$ env ARCHFLAGS="-arch x86_64" gem install ruby-filemagic -- --with-magic-include=/usr/local/include --with-magic-lib=/usr/local/lib/
@tjl2
tjl2 / gist:1330498
Created November 1, 2011 13:29
Changing the count and memory limit of Passenger processes on Engine Yard Cloud

This was going to go into a blog post, but was removed after discussion around it being a Bad Thing for customers to do.

Changing the count and memory limit of Passenger processes

To stop applications that are prone to bloating quickly exhausting all the memory on an application instance, we have a script called passenger_monitor that checks for runaway Passenger processes every minute via a cron job. By default, this script is going to look for Passenger workers that are using over 215MB of memory and kill them. Passenger will restart them when needed. We tune the number of workers that run by default on your application instances, based on the memory specifications so that the memory is sensibly utilized. However, if your application legitimately requires more memory than this (i.e. it isn’t bloating) then it may be advantageous for you to reduce the worker count, and allow the lower number of workers to use more memory.

Doing this involves two areas of customization; modifying the Nginx configuratio