Skip to content

Instantly share code, notes, and snippets.

@ioseb
ioseb / gist:69058
Created February 23, 2009 17:04
JavaScript array chunk function
function arrayChunk(array, size) {
var start = 0, result = [], chunk = [];
while((chunk = array.slice(start, start += size)).length) {
result.push(chunk);
}
return result;
}
@cmonyuk
cmonyuk / gist:868882
Created March 14, 2011 07:49
PHOTON Text Flyer
Saturday April 30, 2011
Wizard Crew Promotions proudly presents
*** PHOTON ***
An Immersive Visual Experience
Wizard Crew is back with our Spring event!
If you enjoyed TECHNOLUST, Back2Bassikz, and Snowmageddon last year, you won't want to miss this.
Musical Performances by
@logankoester
logankoester / rails.vim
Created October 4, 2011 20:34
Useful Rails.vim macros
" Factories and Configuration
Rnavcommand config config -suffix=.yml -default=application
Rnavcommand factory spec/factories test/factories -suffix=.rb -default=model()
" Backbone
Rnavcommand bmodel app/assets/javascripts/backbone/models -suffix=.coffee -default=model()
Rnavcommand bview app/assets/javascripts/backbone/views -suffix=.coffee
" Apotomo Widgets (Cells)
Rnavcommand widget app/widgets -suffix=_widget.rb
@croaky
croaky / HOW_TO.md
Created March 16, 2012 05:43 — forked from michaeldauria/gist:2048022
Migrate from Copycopter 1.0 (hosted by thoughtbot) to Copycopter 2.0 (open source, deploy your own instance)

Use the latest version of the copycopter_client gem:

gem 'copycopter_client', '2.0.0'

Export your published drafts from copycopter.com:

RAILS_ENV=production bundle exec rake copycopter:export

This will create a config/locales/copycopter.yml file.

Wizard Island 2012

We will be camping Friday and Saturday night at sites 87 & 88 on Lake George's Long Island, one of the southernmost islands 4.41 miles by kayak from the Village.

Date Friday September 21st - Sunday September 22nd

Cost $98/person

Limit 8 wizards

@svallory
svallory / extract_clone_all_script.js
Last active December 12, 2015 04:58
Generate shell script to clone all your repositories, or a configured subset of them from your GitHub Dashboard.
// Instructions:
// 1. Navigate to you GitHub dashboard, either (https://github.com or https://github.com/organizations/{org_name}
// 2. Click on "All repositories" or "Show N more repositories" to show all your repos
// 3. Open Firebug console, and paste this script. Optionally, change the options below
// 4. Run and have fun
var options = {
origin: "all", // can be: source, fork or all
visibility: "all", // can be: public, private or all
showInNewWindow: true
@kozo002
kozo002 / jquery.brightness.js
Created October 3, 2013 07:38
Get brightness from background color with jQuery
jQuery.fn.brightness = function() {
var bg_color, rgba, y;
bg_color = this.css('background-color');
if ((bg_color != null) && bg_color.length) {
rgba = bg_color.match(/^rgb(?:a)?\(([0-9]{1,3}),\s([0-9]{1,3}),\s([0-9]{1,3})(?:,\s)?([0-9]{1,3})?\)$/);
if (rgba != null) {
if (rgba[4] === '0') {
if (this.parent().length) return this.parent().brightness();
} else {
y = 2.99 * rgba[1] + 5.87 * rgba[2] + 1.14 * rgba[3];
@grncdr
grncdr / 00-Readme.md
Last active March 3, 2023 05:57
Delete unused assets

Delete unused assets

This is an example script for deleting assets that aren't linked in your content model. It does this by walking through all assets and checking for any links back to them.

WARNING: This script does not take into account assets that are only linked inside of Text fields. If you primarily embed images directly using the markdown editor, this will very likely delete assets you depend on.

You must fill in your own CMA access token & space ID at the top before running

Usage

@shwaydogg
shwaydogg / letsEncryptModulus.md
Last active July 17, 2016 07:09
LetsEncrypt for Modulus Standalone Cetificate only Process

SETUP (nothing new here, it's from the docs)

On another server you control:

$ git clone https://github.com/letsencrypt/letsencrypt

$ cd letsencrypt

$ ./letsencrypt-auto

@stevenharman
stevenharman / 00_Heroku-Release-Phase-Review-Apps-Rails_README.md
Last active May 23, 2024 04:43
Heroku Release Phase script for managing Rails DB migrations, and playing nice with Review Apps and postdeploy scripts

Heroku Release Phase + Review Apps + Rails

This is a simplified, but fairly thorough, set of scripts and configuration to enable Heroku Release Phase for Rails apps. Further, this particular set up plays nicely with Heroku Review Apps in that the release phase script will:

  1. Fail, loudly, if the DB does not yet exist.
  2. Load the DB schema if the current schema version (as determined by bin/rails db:version) is 0.
  3. Run DB migrations otherwise.

For a "normal" app that usually means it will run the DB migrations.