Skip to content

Instantly share code, notes, and snippets.

(function(g, undefined) {
var __index_of = !Array.prototype.indexOf ? function (array, search) {
var len = array.length
, from = Number(arguments[1]) || 0;
from = from < 0 ? Math.ceil(from) : Math.floor(from);
if (from < 0) from += len;
@tatat
tatat / twimg.rb
Created February 15, 2012 20:44
Twitterで OAuth + SSL + まるちぱぁと してみた時の
require 'mime/types'
require 'net/https'
require 'net/http/post/multipart' # sudo gem install multipart-post
require 'oauth' # sudo gem install oauth
CONSUMER_KEY = ''
CONSUMER_SECRET = ''
ACCESS_TOKEN = ''
ACCESS_TOKEN_SECRET = ''
@tatat
tatat / unicode_test.js
Created February 23, 2012 21:48
MySQLにnode.jsでBMP外の文字を保存してみるテスト
/*
* CREATE TABLE `test` (
* `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
* `text` text,
* `binary` blob,
* PRIMARY KEY (`id`)
* ) ENGINE=InnoDB DEFAULT CHARSET=utf8
*
*/
<!--[if IE]><script>
\               ¦         /
  \             ¦        /
             / ̄ ̄ ヽ,
            /        ',      /     _/\/\/\/|_
    \    ノ//, {☎}  /¨`ヽ {☎} ,ミヽ    /     \          /
     \ / く l   ヽ._.ノ   ', ゝ \       <   IE 死  >
     / /⌒ リ   `ー'′   ' ⌒\ \    /          \
     (   ̄ ̄⌒          ⌒ ̄ _)    ̄|/\/\/\/ ̄
      ` ̄ ̄`ヽ           /´ ̄
@tatat
tatat / server.js
Created March 28, 2012 05:08
カジュアルにTwitterからoauth_access_tokenとoauth_access_token_secretを持ってくる
#!/usr/bin/env node
var util = require('util')
, express = require('express') // npm install express
, OAuth = require('oauth').OAuth // npm install oauth
, opts = require('opts'); // npm install opts
opts.parse([{
'short': 'p'
, 'long': 'port'
@tatat
tatat / ⊂( っ☉ω☉)っ.js
Created March 30, 2012 16:07
⊂( っ☉ω☉)っ
var OAuth = require('oauth').OAuth;
var tokens = {
consumer_key: 'YOUR CONSUMER KEY',
consumer_key_secret: 'YOUR CONSUMER KEY SECRET',
access_token: 'YOUR ACCESS TOKEN',
access_token_secret: 'YOUR ACCESS TOKEN SECRET'
};
var oa = new OAuth(
@tatat
tatat / datastore.js
Created May 28, 2012 10:02
データをもにょもにょ
(function(g, undefined) {
var __create = Object.create ? function(o) {
return Object.create(o);
} : function (o) {
function F() {}
F.prototype = o;
return new F();
}
@tatat
tatat / nyan.js
Created May 30, 2012 11:29
なんかキモくて好き
!function() {
var nyan = {};
(function u_nyan(key, value) {
nyan[key] = value;
return u_nyan;
})
('nyan0', 'にゃん')
@tatat
tatat / tweetautoloader.user.js
Created September 15, 2012 06:41
twitter.com ツイート自動読み込みさん
// ==UserScript==
// @name twitter.com ツイート自動読み込みさん
// @version 0.1
// @namespace http://n-at.me/
// @description twitter.com ツイート自動読み込みさん ( ◜◡‾)
// @include http://twitter.com/*
// @include https://twitter.com/*
// @author tatあt
// ==/UserScript==
@tatat
tatat / base64_decode_dataview.js
Created September 25, 2012 07:24
Base64 to DataView
var base64_decode_dataview = (function() {
var __map = {}
, __map_18 = {}
, __map_12 = {}
, __map_6 = {};
!function() {
var chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'
for (var i = 0, j = chars.length, c; i < j; i ++) {