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
begin | |
require "bundler/inline" | |
rescue LoadError => e | |
$stderr.puts "Bundler version 1.10 or later is required. Please update your Bundler" | |
raise e | |
end | |
gemfile(true) do | |
source "https://rubygems.org" | |
gem "rails", '= 4.2.8' |
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
-- define a local table to store all references to functions/variables | |
local M = {} | |
function M:testFunction1() | |
print( "Test 1" ) | |
end | |
function M:testFunction2() | |
print( "Test 2" ) | |
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
[alias] | |
ci = commit | |
co = checkout | |
st = status | |
b = branch | |
lol = log --oneline --graph | |
stash-unapply = !git stash show -p | git apply -R | |
dt = difftool | |
mt = mergetool | |
[merge] |
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
public static class FuncTools | |
{ | |
public delegate Action Recursive(Recursive rs); | |
public static Action YCombinator(Func<Action, Action> f) | |
{ | |
Recursive rec = r => () => f(r(r))(); | |
return rec(rec); | |
} |
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
// McMaster's algorithm | |
void Path::smoothPoints() | |
{ | |
const int LOOKAHEAD = 50; | |
if (points_.size() < 5) | |
return; | |
std::list<PathPoint> newPoints; |
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
for (std::list<PathPoint>::iterator it = ++points_.begin(); | |
it != points_.end(); it++) | |
{ | |
Vector curPos = it->getPosition(); | |
Vector prevPos = (--it)->getPosition(); | |
Vector vecFromPrev = curPos - prevPos; | |
float distance = vecFromPrev.abs(); | |
it++; | |
if (distance > MAX_DISTANCE_BETWEEN_POINTS) | |
{ |
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
import string | |
def make_key_prefix(): | |
import itertools | |
first_chars = "AAAA" | |
for i in itertools.combinations(string.letters, 8 - len(first_chars)): | |
yield first_chars + "".join(i) | |
def sum_up (seq): | |
return sum(seq) % 256 |