Skip to content

Instantly share code, notes, and snippets.

Avatar
🏠
Working from home

Dominik dmnkhhn

🏠
Working from home
View GitHub Profile
@dmnkhhn
dmnkhhn / svgoptimize
Created May 5, 2014
Command line SVG optimizer and base64 converter for CSS, based on https://gist.github.com/mrinterweb/11303706
View svgoptimize
#! /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>"
View update_textmate_bundles.sh
#!/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..."
View Titanium Soundplayer + Scrollview.js
// 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 Jul 11, 2010
Find the WOEID for a location using Yahoo YQL
View titanium.findWOEID.js
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 Jul 10, 2010
How to use a screenshot as a background image for a certain view.
View titanium.screenshotbackground.js
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
});