Skip to content

Instantly share code, notes, and snippets.

View sys1yagi's full-sized avatar

Toshihiro Yagi sys1yagi

View GitHub Profile
@sys1yagi
sys1yagi / gist:1947020
Created March 1, 2012 03:25 — forked from zaki50/gist:1947002
setOnClickListener を生成するテンプレート
${1:import(android.view.View.OnClickListener)}${2:import(android.view.View)}setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
${cursor}
}
});
@sys1yagi
sys1yagi / HeapSort.java
Created August 23, 2012 09:45
javaでヒープソート 効率はよくない
package jp.dip.sys1.yagi.sort;
import java.util.Arrays;
import java.util.Comparator;
import java.util.List;
public class HeapSort {
/**
* ヒープソートやで
@sys1yagi
sys1yagi / QuickSort.java
Created August 23, 2012 12:04
javaでクイックソート 効率はよくない
package jp.dip.sys1.yagi.sort;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Comparator;
import java.util.List;
import java.util.Random;
public class QuickSort {
/**
@sys1yagi
sys1yagi / bookmarklet
Created November 9, 2012 09:42 — forked from tomorrowkey/bookmarklet
expand all tree on google site's sitemap. auto!
javascript:(function(){var t = 1000;var r = 3;var s = function(k){return document.getElementsByClassName('goog-tree-expand-icon-'+k);};var d = function(p){var e=document.createEvent('MouseEvents');e.initMouseEvent('mousedown',true,true,window,0,0,0,0,0,false,false,false,false,0,null);while(p.length>0){p[0].dispatchEvent(e);}};var c = function(){var p=s("tplus");var ps = p.length;d(p);var l=s("lplus");var ls = l.length;d(l);if(r>0){if(ps + ls == 0){console.log("retry");r--;}setTimeout(function(){c();}, t);}};c();})();
@sys1yagi
sys1yagi / ndk-gen-externalToolBuilders.sh
Created December 1, 2012 11:06
generate Eclipse Builders for Android NDK
ndk_path="$ANDROID_NDK_ROOT/ndk-build"
project_name=`xpath .project "/projectDescription/name/text()" 2> /dev/null`
project_path=`pwd`
external_tool_builders=.externalToolBuilders
file_name=ndk-build.launch
if [ ! -d $external_tool_builders ]; then
mkdir $external_tool_builders
fi
@sys1yagi
sys1yagi / gist:4465396
Last active December 10, 2015 17:08
Implementation of logger based on adapter pattern in the Typescript
/** A unified logging interface */
interface Logger{
log(msg: string): void;
}
/** Factory for enums */
class LOGGER_TYPE{
static CONSOLE:string="CONSOLE";
static ALERT:string="ALERT";
static DISPLAY:string="DISPLAY";
}
@sys1yagi
sys1yagi / index.html
Last active December 10, 2015 17:08
use logger. Implementation of logger based on adapter pattern in the Typescript https://gist.github.com/4465396
<html>
<head>
<script type="text/javascript" src="dp.js"></script>
<script type="text/javascript">
var logger;
window.onload = function(){
logger = LogAdapterFactory.createLogger(LOGGER_TYPE.DISPLAY);
logger.log("output log");
}
</script>
@sys1yagi
sys1yagi / index.html
Last active December 10, 2015 21:18
Implementation of shape drawer based on bridge pattern in the Typescript
//Bridge Pattern
/** Implementor */
interface Shape{
draw(context:CanvasRenderingContext2D, x:number, y:number): void;
}
class Circle implements Shape{
color:string;
constructor(private r:number){
this.color = "#"+Math.floor(Math.random() * 0xFFFFFF).toString(16);
@sys1yagi
sys1yagi / index.html
Last active December 10, 2015 22:08
Implementation of directory tree based on composoite pattern in the Typescript
//Composite Pattern
//component
interface Component{
add(child:Component):bool;
remove(child:Component):bool;
getChildren():Component[];
getName():string;
isItem():bool;
}
configure: error: in `/Users/tyagi/Documents/tmp/mobiruby-ios/tmp/libffi/i386-ios-sim':
configure: error: C compiler cannot create executables
See `config.log' for more details
~/Documents/tmp/mobiruby-ios/tmp/libffi
lipo: can't open input file: armv7s-ios/.libs/libffi.a (No such file or directory)
./bin/build-libffi.sh: line 54: armv7s-ios/include/ffi.h: No such file or directory
cp: armv7s-ios/include/ffitarget.h: No such file or directory
./bin/build-libffi.sh: line 54: armv7-ios/include/ffi.h: No such file or directory
cp: armv7-ios/include/ffitarget.h: No such file or directory
./bin/build-libffi.sh: line 54: i386-ios-sim/include/ffi.h: No such file or directory