Skip to content

Instantly share code, notes, and snippets.

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

Dominik dmnkhhn

🏠
Working from home
View GitHub Profile
@dmnkhhn
dmnkhhn / svgoptimize
Created May 5, 2014 13:21
Command line SVG optimizer and base64 converter for CSS, based on https://gist.github.com/mrinterweb/11303706
#! /usr/bin/env ruby
# nokogiri is required below unless --no-modify option is specified
require 'optparse'
require 'tempfile'
@options = {}
OptionParser.new do |opts|
opts.banner = "Usage: svgoptimize [options] <path-to-svg-file>"
@dmnkhhn
dmnkhhn / update_textmate_bundles.sh
Created November 16, 2011 11:59
Update Textmate bundles
#!/bin/sh
#
# Update Textmate bundles
# Standard OS X Textmate bundle Verzeichnis
TEXTMATE_BUNDLES="$HOME/Library/Application Support/Textmate/Bundles"
# … ins Verzeichnis wechseln
echo "\n*** Wechsle ins Textmate bundle Verzeichnis..."
// this little snippet demonstrates how you can handle multiple sounds with just one play button
// switch through the sounds with a simple scroll gesture (by using a ScrollableView
// this code is not complete!! Use it on your own risk. :-)
function createSound(url) {
var file = Titanium.Filesystem.getFile(Titanium.Filesystem.resourcesDirectory, url);
return Titanium.Media.createSound({sound:file});
};
// called once, loading the first sound to play
var sound = createSound('myfile.mp3');
@dmnkhhn
dmnkhhn / titanium.findWOEID.js
Created July 11, 2010 09:59
Find the WOEID for a location using Yahoo YQL
Titanium.Yahoo.yql('select * from yahoo.maps.findLocation where q="'+latitude+','+longitude+'" and gflags="R"',function(e) {
var woeid = e.data.ResultSet.Results.woeid;
Titanium.API.info(woeid);
});
@dmnkhhn
dmnkhhn / titanium.screenshotbackground.js
Created July 10, 2010 08:28
How to use a screenshot as a background image for a certain view.
var screenshot = win.toImage(); // make sure to change 'win' to whatever your window/view is called
var file = Ti.Filesystem.createTempFile(Ti.Filesystem.resourcesDirectory); // create a temporary file
file.write(screenshot); // write the 'screenshot' to that file.
var w = Ti.UI.createWindow({
backgroundImage:file.nativePath // use the native path of the temp file
});