Skip to content

Instantly share code, notes, and snippets.

Avatar

Blake Jakopovic blakejakopovic

View GitHub Profile
@brigand
brigand / index.html
Created May 1, 2014
React Drag and Drop
View index.html
<div id="main"/>
<script type="text/jsx">
/** @jsx React.DOM */
var DragItem = React.createClass({
drag: function(ev) {
ev.dataTransfer.setData("draggedItem", JSON.stringify(this.props.item));
},
render: function () {
return (<div draggable="true" onDragStart={this.drag} className="item">{this.props.item.text}</div>);
}
View definitely_defmethod.clj
user=> (ns there)
nil
there=> (defmulti ^:private doit identity)
#'there/doit
there=> (defmethod doit 1 [x] x)
#<MultiFn clojure.lang.MultiFn@d2de489>
there=> (doit 1)
1
there=> (in-ns 'user)
#<Namespace user>
View gist:296921
gemcutter => redis downloads spec
=================================
keys
----
downloads => global counter for all gem downloads
downloads:today => sorted set for downloads from today
downloads:rubygem:rails => counter for all rails downloads
downloads:version:rails-2.3.5 => counter for all rails 2.3.5 downloads
View deploy.rake
task :deploy => ['deploy:push', 'deploy:restart', 'deploy:tag']
namespace :deploy do
task :migrations => [:push, :off, :migrate, :restart, :on, :tag]
task :rollback => [:off, :push_previous, :restart, :on]
task :push do
puts 'Deploying site to Heroku ...'
puts `git push heroku`
end
@benburkert
benburkert / dpkg.rb
Created Aug 10, 2011 — forked from jedi4ever/dpkg-gnutar
homebrew formula to get dpkg working on a mac
View dpkg.rb
require 'formula'
class Dpkg <Formula
url 'https://launchpad.net/debian/+archive/primary/+files/dpkg_1.16.0.3.tar.bz2'
homepage 'http://en.wikipedia.org/wiki/Dpkg'
md5 '0266b06ef9da8278cea008d21e17e5f6'
depends_on 'gnu-tar'
def patches
@jhuckabee
jhuckabee / tmux_iterm2.rb
Created Mar 14, 2012
Brew script for 'Tmux for iTerm2'
View tmux_iterm2.rb
require 'formula'
class TmuxIterm2 < Formula
url 'http://iterm2.googlecode.com/files/tmux-for-iTerm2-20120203.tar.gz'
md5 '59305a26bdd0245054fe719e6b2a960e'
homepage 'http://code.google.com/p/iterm2/downloads/detail?name=tmux-for-iTerm2-20120203.tar.gz&can=2&q='
depends_on 'libevent'
def install
@clauswitt
clauswitt / BitArray.coffee
Created Mar 25, 2012
A BitArray Implementation in CoffeeScript
View BitArray.coffee
class BitArray
width: 24
constructor: (size=24, default_value = 0) ->
@size = size
initialElements = Math.floor(size / @width) + 1
@field = []
for i in [0...initialElements]
@field[i] = 0
@jhulten
jhulten / server.clj
Created May 26, 2012
clojure udp aleph example
View server.clj
(ns statsd-clj.server
(:use [aleph.udp]
[gloss core io]
[lamina core api])
(:require [statsd-clj.config :as config]
[statsd-clj.metrics :as metrics]
[clojure.tools.logging :as log]))
(def socket-server (agent nil))
View Preferences.json
{
"auto_indent": true,
"auto_match_enabled": true,
"caret_style": "smooth",
"close_windows_when_empty": true,
"color_scheme": "Packages/Theme - Aqua/Color Schemes/Tomorrow Night Aqua.tmTheme",
"detect_indentation": true,
"dictionary": "Packages/Language - English/en_US.dic",
"draw_centered": false,
"draw_indent_guides": true,
@neonichu
neonichu / dashpod.rb
Created Aug 7, 2013
Ruby script which adds documentation for all dependencies from a Podfile to Dash. It's rather hacky and was only tested on Sea Lion, so use at your own risk.
View dashpod.rb
#!/usr/bin/env ruby
require 'rubygems'
require 'cocoapods-core'
require 'json'
require 'mechanize'
require 'rest-client'
docs = JSON.parse(RestClient.get('http://cocoadocs.org/documents.jsonp')[12..-22])