Skip to content

Instantly share code, notes, and snippets.

View rmehner's full-sized avatar
🤷‍♀️
¯\_(ツ)_/¯

Robin Mehner rmehner

🤷‍♀️
¯\_(ツ)_/¯
View GitHub Profile
@rmehner
rmehner / reinstall-rubies.sh
Created April 6, 2014 14:41
Reinstalls all rbenv rubies. Keeping that here for the regular libyaml update ;-)
for ruby in ~/.rbenv/versions/*; do
rbenv uninstall -f ${ruby##*/}
rbenv install ${ruby##*/}
done
function cleanNumberValue(value) {
s = value.replace("'", '', 'g').replace(',', '.');
return +(parseFloat(parseInt(s, 10)) * 1);
}
"There he goes. One of God's own prototypes. A high-powered mutant of some kind never even considered for mass production. Too weird to live, and too rare to die."
<?php
#### configuration ####
$email = 'YOUR_EMAIL_ADDRESS';
$token = 'YOUR_API_TOKEN';
$hostName = 'all'; // use 'all' if you want to update all hosts
#### cURL request below ####
$json_data = json_encode(array(
@rmehner
rmehner / fly_little_drone_fly.js
Created July 9, 2013 14:41
Sample drone script, just to show how easy it is
/**
* Play around with the numbers and the method names!
*
* For example: use counterClockwise and see what happens
*/
var arDrone = require('ar-drone');
var client = arDrone.createClient();
client.takeoff();
@rmehner
rmehner / to_query_string.js
Created May 1, 2013 16:50
Just a tiny helper function to get the query string out of an object (one level deep)
// note: this does not work for nested objects
var toQueryString = function(obj) {
return Object.keys(obj).map(function(key) {
return key + '=' + obj[key];
}).join('&');
};
toQueryString({}); // returns ''
toQueryString({foo: 'bar'}); // returns 'foo=bar'
toQueryString({billable: true, locked: false}); // returns 'billable=true&locked=false'
tell application "Spotify"
return player position
end tell
-- returns 13.37
tell application "Spotify"
return "" & player position
end tell
store_template: &store_template
store:
robot: '/s3/store'
key: 'YOUR_AWS_KEY'
secret: 'YOUR_AWS_SECRET'
bucket: 'YOUR_S3_BUCKET'
production:
auth:
key: 'YOUR_KEY'
@rmehner
rmehner / ostruct_id_patch.rb
Created July 17, 2012 17:54
OpenStruct monkey patch to support id for RUBY_VERSION < 1.9
if RUBY_VERSION < '1.9'
# monkey patching open struct to allow overwriting id method
OpenStruct.__send__(:define_method, :id) { @table[:id] }
end
@rmehner
rmehner / implicit_begin_block.rb
Created June 25, 2012 10:10
implicit begin block
def throw_exception
raise "This is an exception"
rescue => e
puts e.message
end
throw_exception # output: "This is an exception"