Skip to content

Instantly share code, notes, and snippets.

@sudodo
sudodo / server.js
Created October 23, 2011 05:10 — forked from jeffrafter/server.js
Twitter OAuth with node-oauth for node.js+express
var express = require('express');
var sys = require('sys');
var oauth = require('oauth');
var app = express.createServer();
var _twitterConsumerKey = "YOURTWITTERCONSUMERKEY";
var _twitterConsumerSecret = "YOURTWITTERCONSUMERSECRET";
function consumer() {
@sudodo
sudodo / .gitignore
Created October 23, 2011 05:13
sina weibo OAuth with node-oauth for node.js+express
node_modules
config.js
@sudodo
sudodo / server.js
Created October 23, 2011 05:24 — forked from jeffrafter/server.js
Twitter OAuth with node-oauth for node.js+express
var express = require('express');
var sys = require('sys');
var oauth = require('oauth');
var app = express.createServer();
var _twitterConsumerKey = "YOURTWITTERCONSUMERKEY";
var _twitterConsumerSecret = "YOURTWITTERCONSUMERSECRET";
function consumer() {
@sudodo
sudodo / General Rails.logger
Created October 28, 2011 06:40
logger outside ActiveRecord, ActiveController, ActionView
Rails.logger.info "Some debugging info I want to see in my development log."
@sudodo
sudodo / commit_explicitly_in_rails
Created December 1, 2011 05:54
How to commit explicitly in Rails.
ActiveRecord::Base::connection::execute("COMMIT")
@sudodo
sudodo / create_and_send_file_dynamically_by_rails
Created December 2, 2011 01:08
create and send file dynamically by rails
class MyController < ApplicationController
def get_text
data = "generated by rails controller"
send_data(data, :filename => "rails_generated.txt", :type => "text/plain")
#send_file 'evidence_tmp/tmp.zip', :type => "application/zip" # => when the file already exists.
end
end
@sudodo
sudodo / how_to_get_cleared_stash_on_git
Created December 9, 2011 06:24
git stash clearを元に戻す方法
h1. 変更が消えてしまった!?その対応
せっかく実施したコードへの修正が消えてしまう、これほど開発者をがっかりさせることは無いでしょう。
Gitを使えば、消えてしまったように見える変更を復活できることがあります。
h2. 大原則
復活できる可能性があるのは、「何らかの形でGitに履歴を残してある歴史」だけです。
たとえば、以下のファイルを復活させることはできません。
@sudodo
sudodo / git_command_aliases
Created December 21, 2011 07:28
Gitライフを便利にする設定(alias編)
h1. Gitライフを便利にする設定(alias編)
こんな人に効く記事です。
* Gitのコマンドが長いと感じている
* Gitのログを見やすくするコマンドを知りたい
~/.gitconfigに以下を追記してみましょう。
<pre>
[alias]
@sudodo
sudodo / JS_module_pattern_constructor
Created January 21, 2012 06:22
JavaScript constructor module pattern skelton
MYAPP.namespace('MYAPP.utilities.Array');
MYAPP.utilities.Array = (function () {
// dependencies
var uobj = MYAPP.utilities.object,
ulang = MYAPP.utilities.lang;
// private properties and methods...
var Constr;
@sudodo
sudodo / JavaScript module pattern skelton
Created January 21, 2012 06:26
JavaScript module pattern skelton
MYAPP.namespace('MYAPP.utilities.array');
MYAPP.utilities.array = (function () {
// dependencies
var uobj = MYAPP.utilities.object,
ulang = MYAPP.utilities.lang,
// private properties
array_string = "[object Array]", ops = Object.prototype.toString;