Skip to content

Instantly share code, notes, and snippets.

@eric-wieser
eric-wieser / Indent.tmPreferences
Created August 11, 2012 14:53 — forked from stravant/Indent.tmPreferences
Roblox Lua completion support for SublimeText
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>name</key>
<string>Indent</string>
<key>scope</key>
<string>source.lua</string>
<key>settings</key>
<dict>
@eric-wieser
eric-wieser / 2.py
Created August 4, 2012 09:55 — forked from kragniz/2.py
A2S 2
#!/usr/bin/env python
import itertools
def f(a, b, c, d):
return a*b + b*c + c*d + a*d
print max(f(*p) for p in itertools.permutations([1,2,3,4]))
groups:
default:
default: true
permissions:
- modifyworld.*
- bukkit.broadcast.user
- group.default
- ultimatearena.player
- hcw.ban.world.world
if(location.search == "?music") {
//Do music!
var clientId = "dd250c3d9ef318565e6f22e871b87fb8";
var musicUrl = "http://soundcloud.com/alex-nicholls/snakes-theme";
$.getJSON(
'http://api.soundcloud.com/resolve.json?callback=?', {
url: musicUrl,
client_id: clientId
}, function(data) {
if(data.streamable && data.stream_url) {
@eric-wieser
eric-wieser / gist:2831136
Created May 29, 2012 22:16
Javascript key mapping
var keys = {up: 38, right: 39, down: 40, left: 37}; for(var i = 65; i < 91; i++) keys[String.fromCharCode(i+32)] = i;
@eric-wieser
eric-wieser / .tmux.conf
Created April 23, 2012 20:38
Tmux configuration
set -g default-terminal "screen-256color"
#key bindings
#window splitting
unbind %
bind - split-window -v
bind \ split-window -h
#window resizing
@eric-wieser
eric-wieser / event.py
Created March 23, 2012 22:18
Python events, and firing them alongside method invocations
from functools import wraps
#Create a class to house the methods
class fires(object):
@staticmethod
def whenCalled(event):
e = (lambda s: getattr(s, event)) if type(event) == str else (lambda s: event)
def decorator(f):
"""Fires the event before the function executes"""
@eric-wieser
eric-wieser / rename.sh
Created March 13, 2012 20:18 — forked from rabbidrabbit/rename.sh
Rewrites the SR repos history
#!/bin/bash
git filter-branch -f --tag-name-filter cat --env-filter '
an="$GIT_AUTHOR_NAME"
am="$GIT_AUTHOR_EMAIL"
cn="$GIT_COMMITTER_NAME"
cm="$GIT_COMMITTER_EMAIL"
case an in
@eric-wieser
eric-wieser / rename.sh
Created March 13, 2012 19:40 — forked from rabbidrabbit/rename.sh
Rewrites the SR repos history
#!/bin/bash
git filter-branch -f --tag-name-filter cat --env-filter '
an="$GIT_AUTHOR_NAME"
am="$GIT_AUTHOR_EMAIL"
cn="$GIT_COMMITTER_NAME"
cm="$GIT_COMMITTER_EMAIL"
if [ "$GIT_COMMITTER_NAME" = "ew3" ]
@eric-wieser
eric-wieser / alphabet-soup.py
Created January 24, 2012 18:30
119 Character solution to Facebook HackerCup problem 3
t,n='HACKERCUP',input()
for i in range(n):s=raw_input();print'Case #%d: %d'%(i+1,min(s.count(l)/t.count(l) for l in t))