Skip to content

Instantly share code, notes, and snippets.

View MSch's full-sized avatar

Martin Schürrer MSch

View GitHub Profile
@MSch
MSch / bookmarklet.js
Created April 30, 2012 10:54
qando mobile bookmarklet
javascript:d=new Date();document.location='http://m.qando.at/de/get_route.ft?from=DEINE STRASSE 12&time[0]='+d.getHours()+'&time[1]='+d.getMinutes()+'&date[0]='+d.getDate()+'&date[1]='+(d.getMonth()+1)+'&date[2]='+d.getFullYear()
@MSch
MSch / jquery-ui-1.9m7.js
Created April 29, 2012 19:09
jQuery UI 1.9m7
/*!
* jQuery UI 1.9m7
*
* Copyright 2012, AUTHORS.txt (http://jqueryui.com/about)
* Dual licensed under the MIT or GPL Version 2 licenses.
* http://jquery.org/license
*
* http://docs.jquery.com/UI
*/
(function( $, undefined ) {
class App < Thor
def help
puts 'blabla'
end
end
Dir.glob('commands/*.rb').each { |f| require f }
@MSch
MSch / config.ru
Created February 15, 2012 06:46
stupid simple rack app to proxy to a local rails app
# Ever wanted to have http://whatever.dev proxy to your script/server?
Forget all this, just use https://github.com/spagalloco/pow_proxy
require 'benchmark'
# The original implementation by Daniel DeLorme
# http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-talk/256662
class NilClass
def ergo
@blackhole ||= Object.new.instance_eval do
class << self
for m in public_instance_methods
# Add all gems in the global gemset to the $LOAD_PATH so they can be used even
# if they're not in the Gemfile. e.g. pry
if defined?(::Bundler)
global_gemset = ENV['GEM_PATH'].split(':').grep(/ruby.*@global/).first
if global_gemset
all_global_gem_paths = Dir.glob("#{global_gemset}/gems/*")
all_global_gem_paths.each do |p|
gem_path = "#{p}/lib"
$LOAD_PATH << gem_path
end
<scenes>
<scene sceneID="0w1-E2-N09">
<objects>
<placeholder placeholderIdentifier="IBFirstResponder" id="qgN-yu-YsU" userLabel="First Responder" sceneMemberID="firstResponder"/>
<tableViewController id="baW-xq-PM6" customClass="ASViewController" sceneMemberID="viewController">
<tableView key="view" opaque="NO" clipsSubviews="YES" clearsContextBeforeDrawing="NO" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="prototypes" style="plain" rowHeight="44" sectionHeaderHeight="22" sectionFooterHeight="22" id="qpc-DA-sEg">
<rect key="frame" x="0.0" y="20" width="320" height="460"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<prototypes>
defaults write "${TARGET_BUILD_DIR}"/"${CONTENTS_FOLDER_PATH}"/Info GitVersion `git describe --always --dirty`
#!/usr/bin/env ruby
require 'digest/sha1'
require 'io/console'
ALPHABET = ('0'..'9').to_a + ('a'..'z').to_a + ('A'..'Z').to_a
def hmac(key, msg)
split_at = (key.length / 2).floor
enum __app_state {
AppStateDisconnected = 0,
AppStateLookingForDevice,
AppStateConnecting,
AppStateConnected,
};
typedef enum __app_state app_state_t;