Skip to content

Instantly share code, notes, and snippets.

Hello
div.topbar
div.container.fixed
h3.logo
a(href='') GREE
ul
li.active
a(href='') Home
li
a(href='') Mail
li
sys = require 'sys'
path = require 'path'
fs = require 'fs'
argv = require('optimist').boolean('m').argv
if not argv._[0]
process.exit -1
p = require.resolve argv._[0]
http = require 'http'
sys = require 'sys'
EventEmitter = require('events').EventEmitter
mongodb = require 'mongodb'
class Twitter extends EventEmitter
constructor: (path, name, pass) ->
@path = path
@name = name
@pass = pass
vows = require 'vows'
assert = require 'assert'
test = vows.describe('ゼロでの割り算').addBatch
'任意の数をゼロで割った時' :
topic: -> 42 / 0
'無限大になる' : (topic) ->
assert.equal topic, Infinity
'ただし、ゼロをゼロで割った場合'
topic: -> 0/ 0
express = require "express"
xml2js = require 'xml2js'
_ = require "underscore"
request = require "request"
prettyDate = require "./pretty"
class Timeline
constructor: (feed)->
@title = feed.channel.title
@link = feed.channel.link
wsseHeader = require './lib/wsse'
request = require 'request'
entry =
url: 'http://d.hatena.ne.jp/naoya/#atompost'
comment: "This is it"
xml = """
<entry xmlns="http://purl.org/atom/ns#">
<title>dummy</title>
wsseHeader = require './lib/wsse'
request = require 'request'
# entry =
# url: 'http://d.hatena.ne.jp/naoya/#atompost'
# comment: "This is it"
# xml = """
# <entry xmlns="http://purl.org/atom/ns#">
# <title>dummy</title>
@naoya
naoya / og.coffee
Created October 19, 2011 10:13
Scraping OpenGraph w/ node + jsdom + jQuery
jsdom = require 'jsdom'
jsdom.env
html: 'http://b.hatena.ne.jp/articles/201110/6114'
scripts: [ 'http://code.jquery.com/jquery-1.6.4.min.js' ]
done: (errors, window) ->
$ = window.$
og = {}
$('meta[property^="og:"]').each () ->
og[ $(@).attr('property').match(/og:(.+)$/)[1] ] = $(@).attr 'content'
// Returns a copy of the image that has been transformed using the given affine transform and scaled to the new size
// The new image's orientation will be UIImageOrientationUp, regardless of the current image's orientation
// If the new size is not integral, it will be rounded up
+ (UIImage *)resizedImage:(CGSize)newSize
transform:(CGAffineTransform)transform
drawTransposed:(BOOL)transpose
interpolationQuality:(CGInterpolationQuality)quality
image:(UIImage*)image
hires:(BOOL)hires
{