Skip to content

Instantly share code, notes, and snippets.

View jasp's full-sized avatar
🏠
Working from home

Jakob Skov-Pedersen jasp

🏠
Working from home
View GitHub Profile
@jasp
jasp / Convert to translated with translation in clipboard.tmCommand
Created December 2, 2008 14:54
Simple textmate script to convert an inline string to a translation string for use in Rails 2.2 i18n.
<?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>beforeRunningCommand</key>
<string>nop</string>
<key>command</key>
<string>#!/usr/bin/ruby
$LOAD_PATH &lt;&lt; "#{ENV["TM_SUPPORT_PATH"]}/lib"
require 'ui'
@jasp
jasp / tooggandpad
Created September 27, 2009 11:44
Using sox (http://sox.sourceforge.net/) to convert to ogg and pad 0.25 seconds. The script takes the files to convert as parameters. It's a bit quick and dirty so it won't accept filenames with spaces, and can't work from ogg source files.
#!/bin/sh
FILES="$@"
for filename in $FILES
do
newname=`echo $filename | sed -e 's/\(.*\)\.[a-zA-Z0-9]*$/\1.ogg/g'`
sox $filename $newname pad 0 0.25
done
@jasp
jasp / dhcpd.conf
Created May 23, 2010 10:44
Sample dhcpd config for autoupdate dns with static addr machines.
ddns-update-style interim;
# If you have fixed-address entries you want to use dynamic dns
update-static-leases on;
key rndc-key {
algorithm hmac-md5;
secret YourSecretKeyHere;
}
# In Gemfile
gem 'savon', :git => 'http://github.com/rubiii/savon.git', :branch => 'eight'
gem 'httpclient'
# Run this in the console to fetch the name and address of the first debtor
client = Savon::Client.new do
wsdl.document = "https://www.e-conomic.com/secure/api1/EconomicWebservice.asmx?WSDL"
end
# Authenticate
@jasp
jasp / gist:872411
Created March 16, 2011 12:31
Helper for smart conditional handling of html element in html5 supporting various IE versions.
module ApplicationHelper
# Helper for html element in haml using this method:
# paulirish.com/2008/conditional-stylesheets-vs-css-hacks-answer-neither
def html_tag(lang = "en")
str = '<!--[if lt IE 7 ]> <html lang="' + lang + '" class="no-js ie6"> <![endif]-->'
str << '<!--[if IE 7 ]> <html lang="' + lang + '" class="no-js ie7"> <![endif]-->'
str << '<!--[if IE 8 ]> <html lang="' + lang + '" class="no-js ie8"> <![endif]-->'
str << '<!--[if IE 9 ]> <html lang="' + lang + '" class="no-js ie9"> <![endif]-->'
str << '<!--[if (gt IE 9)|!(IE)]><!-->'
precede str do
@jasp
jasp / relay_timer.ino
Last active August 22, 2017 04:44
Simple serial controllable timer using relay
int timer;
String buffer;
int relay = 7;
void setup() {
// put your setup code here, to run once:
Serial.begin(115200);
while (!Serial) {
; // Wait for serial port to connect
}