Skip to content

Instantly share code, notes, and snippets.

View yaotti's full-sized avatar

Hiroshige Umino yaotti

View GitHub Profile
Started POST "/settings/update" for 127.0.0.1 at 2011-07-11 07:23:05 +0900
ActionController::RoutingError (No route matches "/settings/update"):
これをRoR 3.0で使おうとしている
https://github.com/tardate/rails-twitter-oauth-sample
before_filterのoauth_login_requiredは呼ばれている
callback url: hoge.com/users/callback
で,コールバック時にエラー
Error message
>>
Unknown action
The action 'callback' could not be found for UsersController
#!/bin/sh
# Show # of commits in the repository today
# $ cp num-of-commits.sh .git/hooks/post-commit
num_of_commits=$(git log --oneline --since="today 00:00:00" | wc -l | sed 's/^[ ]*//')
echo "Today's commits: $num_of_commits"
# # Repository dir
# cd $(git rev-parse --show-cdup)
# pwd=${PWD##*/}
# growlnotify -a GitX -t $pwd -m "Today's commits: $num_of_commits"
@yaotti
yaotti / sleep-on-finish.sh
Created January 20, 2011 11:56
make MacOS sleep after some command will be finished
#!/bin/zsh
# $ sleep-on-finish.sh backupd # go sleep after finished backupd
CMD=$1
while `pgrep $CMD > dev/null`; do
sleep 10
done
echo "Finished $CMD"
osascript -e 'tell app "Finder" to sleep'
#!/usr/bin/env ruby
# -*- coding: utf-8 -*-
def fizzbuzz(n)
if n % 3 == 0
print "Fizz"
end
if n % 5 == 0
print "Buzz"
end
public class FizzBuzz {
public int max;
FizzBuzz(int n) {
max = n;
}
FizzBuzz() {
max = 100;
}
public void show() {
@yaotti
yaotti / proofcheck.pl
Created December 19, 2010 12:06
Print the result of last tests
#!/usr/bin/env perl
use strict;
use warnings;
use Cwd;
use YAML::Any;
use Term::ANSIColor;
my $prove_file = Cwd::getcwd() . "/.prove";
if (-f $prove_file) {
my $test_results = YAML::Any::LoadFile($prove_file)->{tests};
@yaotti
yaotti / anything-git-project.el
Created December 15, 2010 03:26
List up all files under the control of git and do something (open/view/delete/etc) with them
(defun anything-c-sources-git-project-for (pwd)
(loop for elt in
'(("Modified files (%s)" . "--modified")
("Untracked files (%s)" . "--others --exclude-standard")
("All controlled files in this project (%s)" . ""))
collect
`((name . ,(format (car elt) pwd))
(init . (lambda ()
(unless (and ,(string= (cdr elt) "") ;update candidate buffer every time except for that of all project files
(anything-candidate-buffer))
#!/usr/bin/env perl
use strict;
use warnings;
use LWP::UserAgent;
use Getopt::Long;
sub listup_changes {
my $ua = LWP::UserAgent->new;
my $response = $ua->get(qw!http://www.emacswiki.org/emacs/?action=rc;raw=1!);
for (split /\n/, $response->decoded_content) {
@yaotti
yaotti / get-hb-entries.pl
Created December 7, 2010 14:55
anything script
#!/usr/bin/env perl
use strict;
use warnings;
use Encode;
use JSON;
use opts;
use Regexp::Common qw/URI/;
use URI::Fetch;
use XML::Feed;