This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var TweeningNumber = React.createClass({ | |
mixins: [tweenState.Mixin], | |
getInitialProps: function() { | |
return { | |
value: 0, | |
duration: 500 | |
}; | |
}, | |
getInitialState: function() { | |
return { value: 0 }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Progress | |
class DefaultFormatter | |
def progress_format(current, total) | |
format("\e[K\e[G %5.2f%% (%s / %s)", current / total.to_f * 100.0, format_number(current), format_number(total)) | |
end | |
def format_number(number) | |
number.to_s.chars.reverse.each_slice(3).map(&:reverse).reverse.map(&:join).join(" ") | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM node:latest | |
MAINTAINER Andreas Alin | |
ADD package.json /app/package.json | |
RUN cd /app && npm install | |
RUN npm install node-sass | |
COPY . /app | |
WORKDIR /app |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'shellwords' | |
class Blamify | |
PORCELAIN_COMMIT_HASH_RE = /^(?<hash>\h{40})\s/ | |
PORCELAIN_LINE_RE = /^\t(?<line>.*)$/ | |
COLORS = (237..255).to_a # Greyscale gradient | |
def initialize(filename) | |
@filename = filename | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var debugArgsPatch = (object, property) => { | |
if (typeof object[property] !== 'function') { | |
throw `Object does not have the function ${property}`; | |
} | |
var origFunc = object[property]; | |
object[property] = (...args) => { | |
console.log(`Call ${property}:`, args); | |
var ret = origFunc.apply(object, args); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
require 'rubygems' | |
require 'hpricot' | |
require 'open-uri' | |
song_name = ARGV.join(" ") | |
class RukindSongFinder | |
def initialize(song_name) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
bind "\033[1~" ed-move-to-beg | |
bind "\033[3~" ed-delete-next-char | |
bind "\033[4~" ed-move-to-end | |
bind "\033[5~" ed-prev-history | |
bind "\033[6~" ed-next-history |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <CoreMIDI/MIDIServices.h> | |
#include <iostream> | |
#include <vector> | |
#include "midi_driver.hpp" | |
MidiDriver::MidiDriver() | |
{ | |
CFStringRef client_name = CFStringCreateWithCString(0, "Drummer", 0); | |
MIDIClientCreate(client_name, 0, 0, &_client); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class CharacterDrawer | |
CHARACTERS = { | |
'A' => [[ [0,0], [2,5], [4,0] ], [ [1,2], [3,2] ]], | |
'B' => [[ [0,0], [0,5], [2,5], [3,4], [2,3], [3,2], [3,1], [2,0], [0,0] ], [ [0,3], [2,3] ]], | |
'C' => [[ [4,1], [3,0], [1,0], [0,1], [0,4], [1,5], [3,5], [4,4] ]], | |
'D' => [[ [0,0], [0,5], [2,5], [3,4], [3,1], [2,0], [0,0] ]], | |
'E' => [[ [3,0], [0,0], [0,5], [3,5] ], [ [0,3], [2,3] ]], | |
'F' => [[ [0,0], [0,5], [3,5] ], [ [0,3], [2,3] ]], | |
'G' => [[ [2,2], [4,2], [4,1], [3,0], [1,0], [0,1], [0,4], [1,5], [3,5], [4,4] ]], | |
'H' => [[ [0,0], [0,5] ], [ [3,0], [3,5] ], [ [0,3], [3,3] ]], |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class String | |
COLORS = [:black, :red, :green, :yellow, :blue, :magenta, :cyan, :white] | |
def colorize(color) | |
value = case color | |
when Symbol | |
COLORS.index(color) || 0 | |
else | |
color | |
end | |
"\e[9#{ value }m#{ self }\e[0m" |
OlderNewer