Skip to content

Instantly share code, notes, and snippets.

View jacquescrocker's full-sized avatar

Jacques Crocker jacquescrocker

View GitHub Profile
@koreno
koreno / README.md
Last active April 1, 2020 10:44
'rebaser' improves on 'git rebase -i' by adding information per commit regarding which files it touched.

Prebase

git-prebase improves on 'git rebase -i' by adding information per commit regarding which files it touched.

  • Each file gets an alpha-numeric identifier at a particular column, a list of which appears below the commit list. (The identifiers wrap around after the 62nd file)
  • Commits can be moved up and down safely (without conflicts) as long as their columns don't clash (they did not touch the same file).

Installation

Add the executable to your path and git will automatically expose it as

@jimtla
jimtla / underscoreR.coffee
Created May 6, 2012 21:51
Add CoffeeScript friendly argument order to Underscore.js
# Five lines of code that will make your underscore + CoffeeScript use cleaner.
# Creates an underscore function for each function in to_reverse with R (short for Reversed) appended to the name.
# The R version moves the function argument (first argument in normal underscore) to the end,
# so you can write:
$(window).scroll _.throttleR 500, ->
console.log "This print's at most every 500ms"
# Instead of:
$(window).scroll _.throttle ->
console.log "This prints at most every 500ms too"
@ryanflorence
ryanflorence / render-multiple-outlets-ember.html
Last active September 20, 2019 02:18
Render templates into multiple outlets with ember.js and the new router.
<!doctype html>
<html lang="en">
<head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8">
<title>Render Multiple Outlets</title>
<script src="js/vendor/jquery.js"></script>
<script src="js/vendor/handlebars.js"></script>
<script src="js/vendor/ember.js"></script>
<script src="js/vendor/ember-data.js"></script>
</head>
@mwunsch
mwunsch / avatar.sh
Last active June 23, 2018 17:41
Random Avatar Generator
curl -s 'http://realbusinessmen.tumblr.com/api/read?type=photo&num=50' | ruby -r'rexml/document' -e 'puts REXML::Document.new(STDIN).elements["tumblr/posts"].to_a.shuffle.pop.map(&:text)'
@sintaxi
sintaxi / hosting-an-event-on-surge.md
Last active December 8, 2017 17:29
Instructions for hosting an event on surge.sh

Hosting a competition on surge.sh

...by adding an EVENT.json file to the root of your project.

Hosting an event on surge is very simple. It's three easy steps.

  1. Publish a project to Surge to your root domain (eg. surge ./myproject superevent.io)
  2. Point superevent.io and *.superevent.io DNS records to surges servers.
  3. Add EVENT.json file with the following properties...
@pizzarob
pizzarob / 01_DropZone.jsx
Last active November 14, 2017 08:28
HTML5 Drag and Drop File Upload React Component
import React from 'react';
import PropTypes from 'prop-types';
import classNames from 'classnames';
const ANIMATION_DURATION = 1000;
class BatchDropZone extends React.Component {
static propTypes = {
@ajsharp
ajsharp / rerun_migrations.rb
Created June 18, 2013 22:38
rake db:migrate:rerun VERSION=123
namespace :db do
namespace :migrate do
desc "Re-run a migration that's already been run"
task :rerun => [:environment, :load_config] do
class ActiveRecord::Migrator
def rerun
target = migrations.detect { |m| m.version == @target_version }
raise UnknownMigrationVersionError.new(@target_version) if target.nil?
target.migrate(:up)
end
scope '/api' do
resources :users, except: [:edit]
end
root to: 'ember#index'
get '*path' => 'ember#index'
@remi
remi / natural_dates.rb
Created November 5, 2012 22:11
Natural Dates in Ruby
#!/usr/bin/env ruby
require "date"
class Fixnum
Date::MONTHNAMES[1..-1].each_with_index do |month, index|
define_method month.downcase do |year|
Date.new(year, index+1, self)
end
end
end
@jimsynz
jimsynz / why.md
Created June 25, 2012 23:12
Hamlbars nested conditions

You wrote:

= hb 'if content.condition1' do
  = hb 'if content.condition2' do
    %p Some paragraph
    = hb 'else'
      %p another paragraph
  = hb 'else'
 %p third paragraph