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
# coding: utf-8 | |
require 'mechanize' | |
Id = 'id' | |
Password = 'password' | |
Mechanize.new do |agent| | |
agent.user_agent = 'Mozilla/5.0 (Linux; U; Android 2.3.2; ja-jp; SonyEricssonSO-01C Build/3.0.D.2.79) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 Mobile Safari/533.1' | |
agent.get 'http://login.yahoo.co.jp/config/login?.lg=jp&.intl=jp&logout=1&.src=www&.done=http://www.yahoo.co.jp' |
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 Array | |
def stable_sort_by | |
n = 0 | |
sort_by { |x| [yield(x), n += 1] } | |
end | |
end | |
p [[83, 'annette'], [82, 'kate'], [82, 'lucy']].sort_by { |x| x[0] } | |
p [[83, 'annette'], [82, 'kate'], [82, 'lucy']].stable_sort_by { |x| x[0] } | |
# p [[83, 'annette'], [82, 'kate'], [82, 'lucy']].stable_sort_by #=> no block given (yield) (LocalJumpError) |
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
# 2012-03-13 | |
# preparation for installation | |
sudo aptitude install build-essential libssl-dev | |
echo 'export PATH="$HOME/local/bin:$PATH"' >> .zshrc # or .bashrc | |
# installation process | |
mkdir -p $HOME/local/src # if doesn't exist yet |
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
// tested with DMD64 D Compiler v2.058 | |
import std.process; | |
void main() { | |
system( "ls" ); | |
} |
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
<!DOCTYPE html> | |
<html lang="ja"> | |
<head> | |
<meta http-equiv="content-type" content="text/html" charset="utf-8"> | |
<meta name="robots" content="noindex, nofollow"> | |
<title>flickable test</title> | |
<!-- use jQuery 1.5.2 daringly | |
<script type="text/javascript" src="http://code.jquery.com/jquery-1.5.2.min.js"></script> | |
<script type="text/javascript" src="http://lagoscript.org/files/jquery/flickable/jquery.flickable-1.0b3.min.js"></script> | |
--> |
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
(1..9).each do |i1| | |
(2..9).each do |i2| | |
(3..9).each do |i3| | |
(4..9).each do |i4| | |
if i1 < i2 && i2 < i3 && i3 < i4 | |
print("#{i1}#{i2}#{i3}#{i4}\n") | |
end | |
end | |
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
#!/bin/sh | |
# Licence: MIT | |
# Created by tomykaira, 2011-10-25 | |
if [ $# -ne 1 ]; then | |
echo "Give me your new project name (only)" | |
exit 1 | |
fi |
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
require 'uri' | |
require 'net/http' | |
require 'multi_json' | |
uri = URI.parse('http://exapmle.com/contents/1.json') | |
res = Net::HTTP.get_response(uri) | |
json = MultiJson.load(res.body, symbolize_keys: true) | |
p json |
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
# ref. http://d.hatena.ne.jp/mizchi/20120706/1341568588 | |
# http://twilog.org/ka_/date-120708 | |
global <<< require \prelude-ls | |
take(n, [x, ...xs]:list) = | |
| n <= 0 => [] | |
| empty list => [] | |
| otherwise => [x] +++ take n - 1, xs | |
# | otherwise => x & take n - 1, xs # obsolete from version 0.9.11 |
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
# rewrite this https://github.com/Guti/Google-Cloud-Messaging--Titanium-/blob/6ac1270026f3cc266f37812b64ef40f2ab1b9055/example/PushNotification.js | |
exports.pushNotification = -> | |
hostURL = 'http://YOUR_HOST_URL/register?' | |
gcm = require 'com.activate.gcm' | |
Ti.API.info "module gcm is => #{gcm}" | |
Ti.API.info 'Registering...' |
OlderNewer