Skip to content

Instantly share code, notes, and snippets.

View georgi's full-sized avatar

Matthias Georgi georgi

  • Meta
View GitHub Profile
@georgi
georgi / gist:976507
Created May 17, 2011 13:55
Exception ValueError
import kivy
kivy.require('1.0.0')
from kivy.lang import Builder
from kivy.app import App
from kivy.clock import Clock
from kivy.core.image import Image
from kivy.graphics import *
from kivy.uix.widget import Widget
from kivy.uix.label import Label
[ [ -3.819558145292103e-7 ],
[ -5.35226996671632e-7 ],
[ 0.000002393972935819372 ],
[ -0.0000028440602496875524 ],
[ 0.000001939623125624494 ],
[ 1.2133380581455064e-7 ],
[ -0.000002130055512554684 ],
[ 0.000003797583578709503 ],
[ -0.000004082173036187974 ],
[ 0.0000021020953555030604 ],
(defun copy-line (n)
(let ((column (current-column))
(line (buffer-substring (line-beginning-position) (+ (line-end-position) 1))))
(beginning-of-line)
(forward-line n)
(insert line)
(forward-line -1)
(forward-char column)))
<h1>HEY</h1>
set expandtab "Use softtabstop spaces instead of tab characters for indentation
set shiftwidth=2 "Indent by 4 spaces when using >>, <<, == etc.
set softtabstop=2 "Indent by 4 spaces when pressing <TAB>
set autoindent "Keep indentation from previous line
set smartindent "Automatically inserts indentation in some cases
set cindent "Like smartindent, but stricter and more customisable
set tags=TAGS;/
colorscheme slate
@georgi
georgi / gist:1629802
Created January 17, 2012 23:41
getLoginStatus
function (a, b) {
if (!FB._apiKey) {
FB.log('FB.getLoginStatus() called before calling FB.init().');
return;
}
if (a) if (!b && FB.Auth._loadState == 'loaded') {
if (FB._oauth) {
a({
status: FB._userStatus,
authResponse: FB._authResponse
function build() {
local branch=$(git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/\1/')
local job=soundcloud_${branch}_specs_00$1
local url=http://builder.soundcloud.com/view/All/job/${job}/lastBuild/consoleText
local cwd="\/srv\/hudson\/.jenkins\/jobs\/${job}\/workspace\/"
curl -s $url | sed "/\/usr\/local\/rvm\/.*/d" | sed -e "s/$cwd/.\//"
}
@georgi
georgi / gist:1825003
Created February 14, 2012 09:09
Spin server
#!/usr/bin/env ruby
start_time = Time.now
require 'socket'
require 'tempfile'
require File.expand_path('config/application.rb')
require 'rspec/rails'
@georgi
georgi / gist:1865122
Created February 19, 2012 18:44
LINQ in Ruby
class Query
undef select
def method_missing(id, &block)
if block
instance_variable_set("@#{id}", block)
else
instance_variable_get("@#{id}")
end
end
end
@georgi
georgi / client-side-authentication.rb
Created March 8, 2012 12:37
Facebook Mobile Hack Demo
# Login endpoint for client side flow
# Takes a token paremeter and creates a user if necessary
post "/auth" do
client = Facebook.exchange_token(params[:token])
user = User.from_facebook(client)
session[:user] = user.uid
redirect '/'
end
class Facebook