Skip to content

Instantly share code, notes, and snippets.

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Colors</key>
<dict>
<key>Background</key>
<string>0.078 0.078 0.078</string>
<key>InsertionPoint</key>
<string>1.000 1.000 1.000</string>
require 'rubygems'
require 'nokogiri'
require 'mechanize'
require 'ruby-growl'
url = 'https://wellness.sfc.keio.ac.jp/v3/pc.php?page=top&limit=9999'
agent = WWW::Mechanize.new
body = agent.get(url).body
html = Nokogiri::HTML.parse(body, nil, 'EUC-JP')
target = ['ウェルネス', 'ソフトテニス', 'サッカー']
require 'MeCab'
require 'rubygems'
require 'nokogiri'
require 'open-uri'
url = 'http://www.asahi.com/'
text = String.new
nokogiri = Nokogiri::HTML.parse(open(url))
li = nokogiri.xpath('//div[@id="HeadLine"]/ul[@class="Lnk FstMod"]/li[1]/a')
nokogiri = Nokogiri::HTML.parse(open(url + li[0].attribute('href')))
require 'rubygems'
require 'RMagick'
img = Magick::ImageList.new("test.jpg")
for y in 0..img.rows-1
for x in 0..img.columns-1
c = img.pixel_color(x, y)
img.pixel_color(x,y, Magick::Pixel.new(c.red/2, c.green/2, c.blue/2))
end
end
require 'rubygems'
require 'mechanize'
require 'ruby-growl'
growl = Growl.new('localhost', 'wellness_rb', ['event1', 'event2'], nil, '')
url = 'https://wellness.sfc.keio.ac.jp/v3/'
agent = WWW::Mechanize.new
page = agent.get(url)
form = page.forms[0]
form.password = 'username'
nmap <leader>pd :call <SID>Phpdoc()<cr>
function! s:Phpdoc()
let f = substitute(expand('<cword>'), "_", "-", "g")
silent call system('open ''http://php.benscom.com/manual/ja/function.'.f.'.php''')
endfunction
function! s:BlueCloth(line1, line2)
ruby << EOF
require 'rubygems'
require 'bluecloth'
firstline = VIM::evaluate('a:line1').to_i
lastline = VIM::evaluate('a:line2').to_i
text = []
for i in firstline .. lastline
<?php
$test_server = new TestOAuthServer(new MockOAuthDataStore());
$hmac_method = new OAuthSignatureMethod_HMAC_SHA1();
$test_server->add_signature_method($hmac_method);
$sig_methods = $test_server->get_signature_methods();
$sig_method = $sig_methods['HMAC-SHA1'];
#https://twitter.com/oauth/request_tokenを叩く時
$test_consumer = new OAuthConsumer("oauth_consumer_key", "oauth_consumer_secret", NULL);
$req_req = OAuthRequest::from_consumer_and_token($test_consumer, NULL, "GET", "https://twitter.com/oauth/request_token");
"{{{save start state
au BufRead * call <SID>SaveStart()
function! s:SaveStart()
let tmp = @@
silent normal ggyG
let b:start_object = @@
let @@ = tmp
endfunction
<?php
pake_desc('my load data');
pake_task('my_load_data','project_exists');
define('SF_ROOT_DIR', realpath(dirname(__FILE__).'/../..'));
function run_my_load_data($task,$args){
define('SF_APP', array_shift($args));
require_once(SF_ROOT_DIR.DIRECTORY_SEPARATOR.'apps'.DIRECTORY_SEPARATOR.SF_APP.DIRECTORY_SEPARATOR.'config'.DIRECTORY_SEPARATOR.'config.php');
require_once('mysfPropelData.class.php');