Skip to content

Instantly share code, notes, and snippets.

View ryohey's full-sized avatar
👶

ryohey ryohey

👶
View GitHub Profile
@ryohey
ryohey / gist:8702280
Created January 30, 2014 04:00
touch referenced directories Run Script to refresh cocos2d-x js and image resources
touch -cm ${SRCROOT}/../Resources/src
touch -cm ${SRCROOT}/../Resources/res
@ryohey
ryohey / ___FILEBASENAME___.cpp
Last active August 29, 2015 13:56
C++ Class.xctemplate
//
// ___FILENAME___
// ___PROJECTNAME___
//
// Created by ___FULLUSERNAME___ on ___DATE___.
//___COPYRIGHT___
//
#include "___FILEBASENAME___.h"
@ryohey
ryohey / upload-example.coffee
Created July 6, 2014 06:00
node-multiparty-upload-example-app
express = require "express"
multiparty = require "multiparty"
app = express()
app.get "/", (req, res) ->
res.send """
<form action="/" enctype="multipart/form-data" method="post">
<input type="file" name="uploadFile">
<input type="submit">
next = (value) -> "🐱"+value
back = (value) -> value.slice("🐱".length, value.length)
zero = "🐶"
# next = (value) -> [value]
# back = (value) -> value.pop()
# next = (value) -> -> value
# back = (value) -> value()
Twit = require "twit"
twit = new Twit
consumer_key: "TWITTER_CONSUMER_KEY"
consumer_secret: "TWITTER_CONSUMER_SECRET"
access_token: "ACCESS_TOKEN"
access_token_secret: "ACCESS_TOKEN_SECRET"
twit.get "account/verify_credentials", (err, data, res) ->
twitterId = data.id
@ryohey
ryohey / communicate-with-child-process.coffee
Created November 20, 2015 15:27
Wrapping a child process as a class and communicate in electron
remote = global.require "remote"
child_process = remote.require "child_process"
class Foo
start: ->
@child = child_process.spawn "fooProgram", [barArgument]
doFooBar: (arg1, callback) ->
@child.stdin.write arg1
@ryohey
ryohey / json2html.coffee
Last active December 4, 2015 17:43
convert object to <ul><li> and <dl><dt><dd> in CoffeeScript for React.js
json2html = (obj) ->
if obj instanceof Array
list = json2html o for o in obj
<ul>{list}</ul>
else if obj instanceof Object
list = ([
<dt>{key}</dt>
<dd>{json2html value}</dd>
] for key, value of obj)
<dl>{list}</dl>
//
// main.cpp
// FaceTracker
//
// Created by ryohey on 2015/12/11.
//
#include <iostream>
#include <cv.h>
#include <highgui.h>
@ryohey
ryohey / fadeout
Created September 16, 2013 13:20
#!/bin/bash
for in_file in $(ls -1 *.wav)
do
out_file="fade/${in_file}.wav"
echo "Processing: \"$in_file\". Saving as \"$out_file\" ..."
sox "$in_file" "$out_file" fade t 0 0 2
done