Skip to content

Instantly share code, notes, and snippets.

@georgeOsdDev
georgeOsdDev / gist:5893361
Created June 30, 2013 01:13
Detecting input-type.
// See -> http://diveintohtml5.info/detect.html#techniques
function detectInputTypeSupport(type){
var i = document.createElement("input");
i.setAttribute("type", type);
return i.type === type;
}
@georgeOsdDev
georgeOsdDev / example.html
Created July 24, 2013 23:30
Example of draggable css3 animation with Hammer.js.
<!DOCTYPE html>
<html>
<head>
<title>Hammer.js dragdrop with css3 animation example</title>
<link href="http://netdna.bootstrapcdn.com/twitter-bootstrap/2.2.2/css/bootstrap-combined.min.css" rel="stylesheet">
<meta name="viewport" content="user-scalable=no, width=device-width, initial-scale=1, maximum-scale=1">
<style>
h1 {
margin: 30px;
@georgeOsdDev
georgeOsdDev / microphone_input
Created September 18, 2013 17:00
Get microphone input
<html>
<head>
<title></title>
</head>
<body>
<p id='out'></p>
<script type="text/javascript" charset="utf-8">
(function(global){
var analyser;
@georgeOsdDev
georgeOsdDev / gist:6656763
Last active December 23, 2015 15:39
(Copy|Move) files automatically added by photo_stream without directory.
#ls
find ~/Library/Application\ Support/iLifeAssetManagement/assets/sub -type f \( -name "*.JPG" -o -name "*.jpg" \) -print0 | xargs -0 -J% ls
#copy
find ~/Library/Application\ Support/iLifeAssetManagement/assets/sub -type f \( -name "*.JPG" -o -name "*.jpg" \) -print0 | xargs -0 -J% cp % ~/dist
#move
find ~/Library/Application\ Support/iLifeAssetManagement/assets/sub -type f \( -name "*.JPG" -o -name "*.jpg" \) -print0 | xargs -0 -J% mv % ~/dist
@georgeOsdDev
georgeOsdDev / gist:6914757
Last active December 25, 2015 04:09
js callback
var callbacks = (function(){
var cbs = [];
// copy from underscore.js
var slice = Array.prototype.slice,
isFunction = function(obj) {
return typeof obj === 'function';
},
head = function(array, n, guard) {
if (array == null) return void 0;
return (n == null) || guard ? array[0] : slice.call(array, 0, n);
@georgeOsdDev
georgeOsdDev / FROM REPL
Last active December 26, 2015 17:49
Failed to parse XML document. ##This is reproduce flow. 1. Capture tcpflow ``` sudo tcpflow -c -i lo0 src or dst host localhost ``` 2. Do scala script from REPL ##Solution Add `elementText = elementText.trim();` in `com.amazonaws.services.s3.model.transform.XmlResponsesSaxParser#endElement`
import java.io.ByteArrayInputStream
import scala.collection.JavaConversions._
import scala.io.Source
import scala.util.control.NonFatal
import com.amazonaws.{AmazonClientException, AmazonServiceException}
import com.amazonaws.{ClientConfiguration, Protocol}
import com.amazonaws.auth.BasicAWSCredentials
import com.amazonaws.services.s3.AmazonS3Client
@georgeOsdDev
georgeOsdDev / index.html
Created November 20, 2013 01:55
css diamond
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>CSS diamond</title>
<style type="text/css">
div.diamond {
position: relative;
@georgeOsdDev
georgeOsdDev / coffeeyuidoc.sublime-snippet
Created December 12, 2013 07:48
Sublime snippet for yuidoc style document block of coffee-script.
<snippet>
<content><![CDATA[
###*
# [bind description]
# @type {[type]}
###
]]></content>
<!-- Optional: Set a tabTrigger to define how to trigger the snippet -->
<tabTrigger>###*#</tabTrigger>
<!-- Optional: Set a scope to limit where the snippet will trigger -->
@georgeOsdDev
georgeOsdDev / gist:8265458
Last active January 2, 2016 06:48
Restart VirtualBox
sudo launchctl load /Library/LaunchDaemons/org.virtualbox.startup.plist
#or
sudo /Library/StartupItems/VirtualBox/VirtualBox restart
@georgeOsdDev
georgeOsdDev / gist:8628456
Created January 26, 2014 04:35
grunt task to get commit version
grunt.registerTask 'commitVersion', 'get current commit version', ->
done = @.async()
{ exec } = require 'child_process'
exec 'echo `git log | head -n 1 | cut -c 8-14`', (err, stdout, stderr)->
if (err)
grunt.warn(err)
return done()
commitVersion = stdout.replace "\n", ""
# do some stuff with commitVersion
fs = require 'fs'