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
package tw.loli.inputTest; | |
import android.content.Context; | |
import android.graphics.Color; | |
import android.text.Editable; | |
import android.text.InputType; | |
import android.text.method.MetaKeyKeyListener; | |
import android.util.Log; | |
import android.view.KeyEvent; | |
import android.view.View; | |
import android.view.inputmethod.BaseInputConnection; |
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
#!/usr/local/bin/ruby19 | |
require 'rubygems' | |
require 'net/ssh' | |
PASSWORD = '.....' | |
def shell | |
Net::SSH.start('127.0.0.1','user',:password => PASSWORD) do |ssh| | |
yield(SudoWrapper.new(ssh, PASSWORD)) | |
end | |
end |
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
zh-TW: | |
admin: | |
home: | |
name: "網站首頁" | |
pagination: | |
previous: "« 前頁" | |
next: "次頁 »" | |
truncate: "…" | |
misc: | |
filter_date_format: "mm/dd/yy" # a combination of 'dd', 'mm' and 'yy' with any delimiter. No other interpolation will be done! |
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
class Book < ActiveRecord::Base | |
attr_accessible :authors_attributes | |
has_and_belongs_to_many :authors | |
accepts_nested_attributes_for :authors | |
def authors_attributes=(new_authors) | |
self.authors = new_authors.collect do |author_attrs| | |
if author_id = author_attrs.delete(:id) | |
author = Author.find(author_id) rescue nil |
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
<?php | |
$key = get_ruten_key(); | |
$good_url = 'http://goods.ruten.com.tw/item/show?21109087634023'; | |
$context = stream_context_create(array( | |
'http' => array( | |
'header' => | |
"User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.1 (KHTML, like Gecko) Chrome/21.0.1180.77 Safari/537.1\r\n". | |
"Referer:$good_url\r\n". | |
"Cookie: _ts_id=$key\r\n" |
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/bash | |
# Save this file to /usr/bin/rbenv.bash, chmod +x it, and set SHELL variable in crontab to this. | |
export RBENV_ROOT=/usr/local/rbenv | |
export PATH="$RBENV_ROOT/bin:$PATH" | |
eval "$(rbenv init -)"; | |
bash "$@" |
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
<?php | |
$hooks = array(); | |
add_action('all', function($hook){ | |
global $hooks; | |
$hooks[]= $hook; | |
}); | |
add_action('admin_print_scripts', function(){ | |
global $hooks; | |
echo "<script>console.log('hooks:'); console.log('".implode(',',array_unique($hooks))."');</script>"; |
We can't make this file beautiful and searchable because it's too large.
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
10001,臺北市中正區,中山南路 | |
10002,臺北市中正區,中山南路 | |
10005,臺北市中正區,重慶南路一段 | |
10006,臺北市中正區,重慶南路一段 | |
10007,臺北市中正區,重慶南路一段 | |
10008,臺北市中正區,重慶南路一段 | |
10009,臺北市中正區,衡陽路 | |
10012,臺北市中正區,忠孝西路一段 | |
10013,臺北市中正區,羅斯福路一段 | |
10014,臺北市中正區,南海路 |
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
# ==== | |
# PoC: dot access to specific hash instance | |
# === | |
x = {a: 1, b:2} | |
# override method_missing | |
original_method_missing = x.method(:method_missing) | |
x.define_singleton_method :method_missing do|name, *args, &block| | |
return x[name] if x.key? name |
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
$('#settings-tabs a[data-target]').click (e)-> | |
e.stopPropagation() | |
e.preventDefault() | |
history.pushState(null, null, $(this).attr('href')) | |
$('#settings-tabs .active').removeClass('active') | |
$(this).closest('li').addClass('active') | |
active_pane = $($(this).data('target')) | |
active_pane.closest('.tab-content').find('.tab-pane.active').removeC |
OlderNewer