Skip to content

Instantly share code, notes, and snippets.

View h4ck4life's full-sized avatar

Alif h4ck4life

  • Dev.
  • Kuala Lumpur
View GitHub Profile
@h4ck4life
h4ck4life / sc-dl.js
Created March 6, 2012 02:56 — forked from pheuter/sc-dl.js
Bookmarklet that generates download link for a Soundcloud upload
(function(d) {
var dl = d.createElement('a');
dl.innerText = 'Download MP3';
dl.href = "http://media.soundcloud.com/stream/"+d.querySelector('#main-content-inner img[class=waveform]').src.match(/\.com\/(.+)\_/)[1];
dl.download = d.querySelector('em').innerText+".mp3";
d.querySelector('.primary').appendChild(dl);
dl.style.marginLeft = '10px';
dl.style.color = 'red';
dl.style.fontWeight = 700;
})(document);
{
"ANDROID_VERSION": 1.5,
"APP_VERSION_CODE": 8,
"APP_VERSION_NAME": 1.3,
"AVAILABLE_MEM_SIZE": 181972992,
"BRAND": "generic",
"BUILD": {
"BOARD": "unknown",
"BRAND": "generic",
"DEVICE": "generic",
@h4ck4life
h4ck4life / logismo.js
Created September 10, 2013 16:16 — forked from ericf/logismo.js
YUI.add('logismo', function(Y) {
/**
* Logismo
*/
var Logismo,
LOGISMO = 'logismo',
EVENTS_RESOURCE_PATH = 'eventsResourcePath',
<!DOCTYPE HTML>
<html>
<head>
<script src="http://yui.yahooapis.com/3.5.1/build/yui/yui-min.js"></script>
</head>
<body class="yui3-skin-sam">
<div id="app"></div>
<script>
this.before(function(){
var res = this.response;
if ('OPTIONS' == this.request.method) {
res.setHeaders(200,{
'Content-Type': 'text/plain',
'Access-Control-Allow-Origin': '*',
'Access-Control-Allow-Methods': 'GET, PUT, POST, DELETE, OPTIONS',
'Access-Control-Allow-Headers': 'Content-Type, Authorization, X-Requested-With',
'Access-Control-Max-Age': 5184000 //2 months
@With(Compress.class)
public class Application extends Controller {
public static void index() {
render();//response will be gzipped
}
}
sudo apt-get install build-essential libssl-dev curl
# The install script
# Adapted from https://gist.github.com/579814
echo '# Added by install script for node.js and npm in 30s' >> ~/.bashrc
echo 'export PATH=$HOME/local/bin:$PATH' >> ~/.bashrc
echo 'export NODE_PATH=$HOME/local/lib/node_modules' >> ~/.bashrc
. ~/.bashrc
<ehcache xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../config/ehcache.xsd" updateCheck="false">
<!-- This is a default configuration for 256Mb of cached data using the JVM's heap, but it must be adjusted
according to specific requirement and heap sizes -->
<defaultCache
maxBytesLocalHeap="256000000"
eternal="false"
timeToIdleSeconds="120"
timeToLiveSeconds="120"
@h4ck4life
h4ck4life / this.js
Created December 31, 2013 02:23 — forked from cyrus-and/this.js
// JavaScript `this` examples from http://stackoverflow.com/a/12371105/477168
// The value of this in a function is sometimes called the "context" in which
// the function runs. The most important thing to understand is that a function
// object does not have a fixed context -- the value of this changes depending
// on how the function is called.
// If the function is called as a "raw" function (e.g., just do someFunc()),
// this will be window (or undefined if the function runs in strict mode).