Skip to content

Instantly share code, notes, and snippets.

@tlync
tlync / gist:1992497
Created March 7, 2012 10:54
Reload a web page on iPhone Simulator (elisp)
(defun web-reload-iphonesimulator ()
"Reload a page on iPhone Simulator. Run process associated to the *Messages* buffer"
(interactive)
(start-process-shell-command
"iphonesimulator-process"
"*Messages*"
"osascript -e 'tell application \"System Events\"' -e 'tell process \"iPhone Simulator\"' -e 'click button \"Reload\" of window 1' -e 'end tell' -e 'end tell'"))
@tlync
tlync / reload-iphonesimulator-safari.scpt
Created March 7, 2012 10:45
Reload a web page on iPhone Simulator
tell application "System Events"
tell process "iPhone Simulator"
click button "Reload" of window 1
end tell
end tell
@tlync
tlync / gist:1868304
Created February 20, 2012 07:48
Wrapper for android Log class
package me.tlync.android.util;
import android.util.Log;
/**
* Android Log wrapper class that can use {@link String#format(String, Object...)} in logging message
*/
public class Logger {
private static final String TAG = Logger.class.getSimpleName();
@tlync
tlync / jquery-feedbackable.js
Created October 14, 2011 10:21
jquery-feedbackable.js
(function($) {
var hasTouch = 'ontouchstart' in window;
/**
* @param {number} [amount=2]
* @param {string} [direction=both] both, h, v
*/
$.fn.feedbackable = function(options){
var settings = $.extend({
@tlync
tlync / xui-tap.js
Created October 14, 2011 10:17
tap for xui
(function(){
var hasTouch = 'ontouchstart' in window;
x$.extend({
tap: function(fn, delay){
// browser fallback
if(!hasTouch){
return this.each(function(){
x$(this).click(fn);
@tlync
tlync / haml2html.js
Created September 5, 2011 07:57
Haml to html in realtime
// usege: node haml2html <file>
var sys = require('util'),
fs = require('fs'),
http = require('http'),
exec = require('child_process').exec
var argv = process.argv,
target = argv[2]
if(!target){
@tlync
tlync / jquery-outer.js
Created June 9, 2011 05:01
jquery outer width/height plugin - Set the outer width/height of each element in the set of matched elements.
//TODO: refactoring
(function($){
var origOuterWidth = $.fn.outerWidth,
origOuterHeight = $.fn.outerHeight;
/**
* Get the current outer width for the first element in the set of matched elements.
* or set the outer width of each element in the set of matched elements.
*
@tlync
tlync / jquery-doubletap.js
Created June 9, 2011 03:45
jquery double tap plugin - Bind an event handler to the "double tap" JavaScript event.
(function($){
var hasTouch = /android|iphone|ipad/i.test(navigator.userAgent.toLowerCase()),
eventName = hasTouch ? 'touchend' : 'click';
/**
* Bind an event handler to the "double tap" JavaScript event.
* @param {function} doubleTapHandler
* @param {number} [delay=300]
*/
@tlync
tlync / gist:988407
Created May 24, 2011 09:16
bookmarklet: list webkit properties
javascript:(function(){var p=[];for(var i in window){if(/webkit/i.test(i))p.push(i);}p.sort();alert(p.join('\n'));})();
;;; js-beautify.el -- beautify some js code
(defgroup js-beautify nil
"Use jsbeautify to beautify some js"
:group 'editing)
(defcustom js-beautify-args "--jslint-happy --brace-style=end-expand --keep-array-indentation"
"Arguments to pass to jsbeautify script"
:type '(string)
:group 'js-beautify)