Skip to content

Instantly share code, notes, and snippets.

@hamada-lemois
hamada-lemois / grep.sh
Created June 27, 2016 09:50
`git grep`-ish grepping
grep -rn --color=always "Texts to search" . | less -R
@hamada-lemois
hamada-lemois / main.cpp
Created March 16, 2016 14:13
static const string members of struct in class
#include <iostream>
class Character {
public:
struct Direction {
static const std::string Front;
static const std::string Back;
static const std::string Left;
static const std::string Right;
};
@hamada-lemois
hamada-lemois / blender_cleanup_rigs.py
Last active August 29, 2015 11:55
BlenderからUnityにリグをもっていくためのスクリプト / The script to bring rigs for Unity from Blender
import re
import bpy
porg = re.compile('ORG-*')
for object in bpy.context.object.data.bones:
object.use_deform = False
for object in bpy.context.object.data.bones:
if porg.match(object.name):
@hamada-lemois
hamada-lemois / slforever.sh
Created August 3, 2015 14:51
SLが走り続けるbashワンライナー
while; do sl; done;
@hamada-lemois
hamada-lemois / burnImg.sh
Last active August 29, 2015 14:25
burn ‘.img’ to disk.
sudo diskutil unmount /dev/disk1s1
sudo dd bs=1m if=path/to/disk/image.img of=/dev/rdisk1
'use strict';
function guid() {
function s4() {
return Math.floor((1 + Math.random()) * 0x10000)
.toString(16)
.substring(1);
}
return s4() + s4() + '-' + s4() + '-' + s4() + '-' + s4() +
@hamada-lemois
hamada-lemois / sum-of-list.lisp
Created July 27, 2015 15:10
リストの内容の和を返す関数
(defun sum-of-list (list)
(defun it (list sum)
(if (/= 0 (length list))
(it (rest list) (+ sum (first list)))
sum))
(it list 0))
(sum-of-list '(1 2 3 4 5 6 7 8 9))
@hamada-lemois
hamada-lemois / fib.lisp
Created July 27, 2015 15:09
フィボナッチ数列
(defun fib (count)
(defun fib-it (a b i count)
(format t "~a~%" a)
(if (< i count)
(fib-it b (+ a b) (incf i) count)))
(fib-it 0 1 0 count))
(fib 100)
@hamada-lemois
hamada-lemois / ViewController.swift
Created April 11, 2015 08:29
Subclassing UIViewController
import UIKit
class ViewController: UIViewController {
required init(coder aDecoder: NSCoder) {
super.init(coder: aDecoder)
}
override init(nibName nibNameOrNil: String!, bundle nibBundleOrNil: NSBundle!) {
@hamada-lemois
hamada-lemois / AddConstraintSample.swift
Created January 28, 2015 07:10
SwiftでConstraint
var topConstraint = NSLayoutConstraint(
item: view,
attribute: .Top,
relatedBy: .Equal,
toItem: subView,
attribute: .Top,
multiplier: 1,
constant: 0)
var leadingConstraint = NSLayoutConstraint(
item: view,