Skip to content

Instantly share code, notes, and snippets.

View yuchan's full-sized avatar

Yusuke Ohashi yuchan

View GitHub Profile
@yuchan
yuchan / altkoo
Last active August 29, 2015 14:22
Altkoo
#!/usr/bin/env ruby
# coding: utf-8
# "ALTKOO"を並び替えます。
word = "ALTKOO"
carray = word.split(//)
carray.permutation.to_a.each do |elem|
p elem.join("")
end
//
// YODDLog.h
// CocoaLumberjack Configuration
//
// Created by Ohashi Yusuke on 1/2/15.
// Copyright (c) 2015 Ohashi Yusuke. All rights reserved.
//
#ifndef _RSLogger_h
#define _RSLogger_h
brew list | sed -e 's/^/brew install /g' | awk '{print $1 " " $2 " " $3}' > homebrew.sh
(defun fizzbuzz (n)
(cond
((= (% n 15) 0) "FizzBuzz")
((= (% n 5) 0) "Buzz")
((= (% n 3) 0) "Fizz")
(t n))) ; => fizzbuzz
(fizzbuzz 10) ; => "Buzz"
(fizzbuzz 2) ; => 2
@yuchan
yuchan / GenerateTestCode.py
Last active August 29, 2015 14:07
Generate XCTestCase subclasses from all source classes.
#!/usr/bin/env python
import os
XCTestCaseFormat = """//
// {ClassName}.m
// NrKj_iPhone
//
// Created by {Author} on {Date}.
//
@yuchan
yuchan / ios8transformsucks.m
Last active August 29, 2015 14:06
iOS8 uiview transformation snippet
// no transforms applied to window in iOS 8
BOOL ignoreOrientation = [[NSProcessInfo processInfo] respondsToSelector:@selector(operatingSystemVersion)];
if(!ignoreOrientation && UIInterfaceOrientationIsLandscape(orientation)) {
//iOS8 landscape
}else if(UIInterfaceOrientationIsLandscape(orientation)) {
//~iOS7 landscape
}else {
// portrate
}
@yuchan
yuchan / array.coffee
Last active August 29, 2015 14:06
Learning CoffeeScript
animals = [
'dog',
'cat',
'elephant']
console.log animals
@yuchan
yuchan / syncmaster.sh
Last active August 29, 2015 14:06
Sync master from forked repository.
#! /bin/bash
# http://stackoverflow.com/questions/7244321/how-to-update-github-forked-repository
git fetch upstream
git checkout master
git rebase upstream/master
git push -f origin master
#!/usr/bin/env python
# multiply numbers between 1..30, and answer number of zeros of the tail.
num = 1
count = 0
for i in range(1,31):
num *= i
while num % 10 == 0:
num /= 10
#! /usr/bin/env python
import sys
args = sys.argv
f = open("test.txt",'r+')
s = args[1]+"\n"
for l in f: