This file contains hidden or 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
require 'mechanize' | |
require "logger" | |
require 'json' | |
def login_url | |
"http://www.xiami.com/member/login" | |
end | |
def checkin_url | |
"http://www.xiami.com/task/signin" |
This file contains hidden or 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
find ./ -name "*.png" -depth 1 | sed 's:\([^/]*\.png\):\1 \1\.new:g' | xargs -n 2 /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/pngcrush -revert-iphone-optimizations |
This file contains hidden or 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
source :rubygems | |
gem 'rest-client' | |
gem 'multi_json' |
This file contains hidden or 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 <Foundation/Foundation.h> | |
@interface NSObject (AMAssociatedObjects) | |
- (void)associateValue:(id)value withKey:(void *)key; // Retains value. | |
- (id)associatedValueForKey:(void *)key; | |
@end |
This file contains hidden or 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
alias respring="killall SpringBoard" | |
alias grep="grep --color=tty" |
This file contains hidden or 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/bin/awk -f | |
BEGIN { | |
g_max = -1; | |
g_min = 999999999; | |
} | |
{ | |
match($0, /[0-9]*\ \"-\"/); | |
timeInterval = substr($0, RSTART, RLENGTH - 4) / 1e6; | |
g_count += timeInterval; | |
g_max = (g_max > timeInterval ? g_max : timeInterval); |
This file contains hidden or 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
<%= content_for :title do %> | |
关于我们 - VIDA(唯达) - 你我的生活轨迹 | |
<% end -%> | |
<%= content_for :meta_description do %> | |
Vida 在西班牙语和葡萄牙语中是Life的意思,我们以此寓意为我们的产品命名。 | |
<% end-%> | |
<div id="contact"> | |
<a id="follow-us" href="http://weibo.com/vidafm" onClick="javascript: pageTracker._trackPageview('clicktrack-frontpage-followus');">关注我们的新浪微博 @vida_唯达</a> |
This file contains hidden or 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
require 'rest_client' | |
class KVStore | |
def self.shared_instance | |
@@_shared_instance ||= RestClient::Resource.new("http://api.openkeyval.org") | |
end | |
def self.store(key, value = nil) | |
shared_instance[key].post({:data => value}) | |
end |
This file contains hidden or 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
%form{:action=>"/upload",:method=>"post",:enctype=>"multipart/form-data"} | |
%input{:type=>"file",:name=>"file"} | |
%input{:type=>"submit",:value=>"Upload"} |
This file contains hidden or 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
require 'sinatra' | |
post '/upload' do | |
unless params[:file] && | |
(tmpfile = params[:file][:tempfile]) && | |
(name = params[:file][:filename]) | |
@error = "No file selected" | |
return haml(:upload) | |
end | |
STDERR.puts "Uploading file, original name #{name.inspect}" |