This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import android.app.Service; | |
import android.content.Intent; | |
import android.os.IBinder; | |
import android.util.Log; | |
import com.koushikdutta.async.AsyncNetworkSocket; | |
import com.koushikdutta.async.AsyncServer; | |
import com.koushikdutta.async.AsyncServerSocket; | |
import com.koushikdutta.async.AsyncSocket; | |
import com.koushikdutta.async.ByteBufferList; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class OneLog { | |
public static String TAG = OneLog.class.getName(); | |
private OneLog() { | |
} | |
public static int v(String msg) { | |
return android.util.Log.v(TAG, msg); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import android.os.CountDownTimer; | |
abstract public class CountUpTimer | |
{ | |
private CountDownTimer countDownTimer; | |
private int countDownCycle; | |
public CountUpTimer(long countUpInterval) { | |
countDownTimer = new CountDownTimer(Long.MAX_VALUE, countUpInterval) { | |
@Override |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Adapted from https://gist.github.com/paulirish/1579671 which derived from | |
// http://paulirish.com/2011/requestanimationframe-for-smart-animating/ | |
// http://my.opera.com/emoller/blog/2011/12/20/requestanimationframe-for-smart-er-animating | |
// requestAnimationFrame polyfill by Erik Möller. | |
// Fixes from Paul Irish, Tino Zijdel, Andrew Mao, Klemen Slavič, Darius Bacon | |
// MIT license | |
(function() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
DB_USER="root" | |
DB_PW="root" | |
DATE=`date +%d%m%y%H%M` | |
S3_BUCKET="s3://my-bucket" | |
# export database | |
mysqldump -u $DB_USER -p${DB_PW} --all-databases | gzip > /opt/backups/db_${DATE}.bak.gz | |
cp /opt/backups/db_${DATE}.bak.gz /opt/backups/db-latest.bak.gz |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
DIR=`/var/www` | |
NAME=`www` | |
DATE=`date +%d%m%y%H%M` | |
S3_BUCKET="s3://my-bucket" | |
# export files | |
tar czf /opt/backups/${NAME}_${DATE}.tar -C / ${DIR} | |
cp /opt/backups/${NAME}_${DATE}.tar /opt/backups/${NAME}-latest.tar |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module ActionView::Helpers | |
module Tags | |
class CollectionSelect < Base | |
def render | |
option_tags_options = { | |
:selected => @options.fetch(:selected) { value(@object) }, | |
:include_selected => @options.fetch(:include_selected, false), | |
:disabled => @options[:disabled] | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module SimpleForm | |
module Wrappers | |
class Many | |
private | |
def wrap(input, options, content) | |
return content if options[namespace] == false | |
return if defaults[:unless_blank] && content.empty? |