start new:
tmux
start new with session name:
tmux new -s myname
import android.content.Context; | |
import android.os.Debug; | |
import java.io.File; | |
public class OomExceptionHandler implements Thread.UncaughtExceptionHandler { | |
private static final String FILENAME = "out-of-memory.hprof"; | |
public static void install(Context context) { | |
Thread.UncaughtExceptionHandler defaultHandler = Thread.getDefaultUncaughtExceptionHandler(); |
/* | |
* Copyright 2014 Chris Banes | |
* | |
* Licensed under the Apache License, Version 2.0 (the "License"); | |
* you may not use this file except in compliance with the License. | |
* You may obtain a copy of the License at | |
* | |
* http://www.apache.org/licenses/LICENSE-2.0 | |
* | |
* Unless required by applicable law or agreed to in writing, software |
private static final int PEEK_DRAWER_TIME_SECONDS = 2; | |
private long downTime; | |
private long eventTime; | |
private float x = 0.0f; | |
private float y = 100.0f; | |
private int metaState = 0; | |
protected void peekDrawer() { | |
downTime = SystemClock.uptimeMillis(); | |
eventTime = SystemClock.uptimeMillis() + 100; |
class CORSResource(object): | |
""" | |
Adds CORS headers to resources that subclass this. | |
""" | |
def create_response(self, *args, **kwargs): | |
response = super(CORSResource, self).create_response(*args, **kwargs) | |
response['Access-Control-Allow-Origin'] = '*' | |
response['Access-Control-Allow-Headers'] = 'Content-Type' | |
return response |
String.prototype.toSlug = function(){ | |
st = this.toLowerCase(); | |
st = st.replace(/[\u00C0-\u00C5]/ig,'a') | |
st = st.replace(/[\u00C8-\u00CB]/ig,'e') | |
st = st.replace(/[\u00CC-\u00CF]/ig,'i') | |
st = st.replace(/[\u00D2-\u00D6]/ig,'o') | |
st = st.replace(/[\u00D9-\u00DC]/ig,'u') | |
st = st.replace(/[\u00D1]/ig,'n') | |
st = st.replace(/[^a-z0-9 ]+/gi,'') | |
st = st.trim().replace(/ /g,'-'); |
#!/bin/bash | |
# from here: http://www.codingsteps.com/install-redis-2-6-on-amazon-ec2-linux-ami-or-centos/ | |
# and here: https://raw.github.com/gist/257849/9f1e627e0b7dbe68882fa2b7bdb1b2b263522004/redis-server | |
############################################### | |
# To use: | |
# wget https://raw.github.com/gist/2776679/04ca3bbb9f085b192f6aca945120fe12d59f15f9/install-redis.sh | |
# chmod 777 install-redis.sh | |
# ./install-redis.sh | |
############################################### | |
echo "*****************************************" |
/*! | |
* isVis - v0.5.5 Aug 2011 - Page Visibility API Polyfill | |
* Copyright (c) 2011 Addy Osmani | |
* Dual licensed under the MIT and GPL licenses. | |
*/ | |
(function () { | |
window.visibly = { | |
b: null, | |
q: document, |
// jQuery.support.transition | |
// to verify that CSS3 transition is supported (or any of its browser-specific implementations) | |
$.support.transition = (function(){ | |
var thisBody = document.body || document.documentElement, | |
thisStyle = thisBody.style, | |
support = thisStyle.transition !== undefined || thisStyle.WebkitTransition !== undefined || thisStyle.MozTransition !== undefined || thisStyle.MsTransition !== undefined || thisStyle.OTransition !== undefined; | |
return support; | |
})(); |