Skip to content

Instantly share code, notes, and snippets.

View Retozi's full-sized avatar

Reto Schläpfer Retozi

View GitHub Profile
@Retozi
Retozi / uni-li.md
Last active July 17, 2017 14:17
Clearance Request
@Retozi
Retozi / darts.py
Last active January 2, 2016 18:04
darts problem
from itertools import product
CLOSING_SCORE = 167
def possible_dart_shots():
shots = []
for k, multi in enumerate(['single', 'double', 'tripple']):
for segment in range(1, 21):
shots.append((multi, (k + 1) * segment))
export class RECEIVE_LANGUAGES extends McParky.NewRequestAction<GlobalAppStore.State> {
constructor() {
super(Http.getLanguages());
}
write(state: GlobalAppStore.State): void {
state.languages = LanguagesState.writeReceiveLanguages(GlobalAppStore.copy(state.languages), this.res);
}
}
alias ls='ls -F --color --show-control-chars'
alias sublime='/c/Program\ Files/Sublime\ Text\ 3/sublime_text ./ &'
# Note: ~/.ssh/environment should not be used, as it
# already has a different purpose in SSH.
env=~/.ssh/agent.env
# Note: Don't bother checking SSH_AGENT_PID. It's not used
# by SSH itself, and it might even be incorrect
"use strict";
var webpack = require('webpack');
function getEntry(type) {
var entry = ['./src/main.js'];
//if dev then prepend dev server for autoreload
if (type === 'dev') {
entry.unshift('webpack/hot/dev-server');
entry.unshift('webpack-dev-server/client?http://localhost:8081');
}
function makeDigestFun(key, callback) {
return function (err, res) {
clearRequestQueue(key);
if (err && err.timeout === TIMEOUT) {
callback(ASYNC.TIMEOUT);
} else if (res.status === 400) {
Api.logout();
} else if (!res.ok) {
callback(ASYNC.ERROR);
} else {
Slider = React.createClass({
getInitialState: ->
{xStart: null, xEnd: null, dragPos: null}
getXs: ->
node = @refs.slider.getDOMNode()
if node?
rect = node.getBoundingClientRect()
@setState({xStart: rect.left, xEnd: rect.right})
AppRouter = Backbone.Router.extend({
routes: {
"entity/:id": "entity"
}
})
appRouter = new AppRouter()
Site = React.createClass({