Skip to content

Instantly share code, notes, and snippets.

Avatar

Toshihiro Yagi sys1yagi

View GitHub Profile
@sys1yagi
sys1yagi / gist:1947020
Created Mar 1, 2012 — forked from zaki50/gist:1947002
setOnClickListener を生成するテンプレート
View gist:1947020
${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 Aug 23, 2012
javaでヒープソート 効率はよくない
View HeapSort.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 Aug 23, 2012
javaでクイックソート 効率はよくない
View QuickSort.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 Nov 9, 2012 — forked from tomorrowkey/bookmarklet
expand all tree on google site's sitemap. auto!
View bookmarklet
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 Dec 1, 2012
generate Eclipse Builders for Android NDK
View ndk-gen-externalToolBuilders.sh
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 Dec 10, 2015
Implementation of logger based on adapter pattern in the Typescript
View gist:4465396
/** 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 Dec 10, 2015
use logger. Implementation of logger based on adapter pattern in the Typescript https://gist.github.com/4465396
View index.html
<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 Dec 10, 2015
Implementation of shape drawer based on bridge pattern in the Typescript
View index.html
//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 Dec 10, 2015
Implementation of directory tree based on composoite pattern in the Typescript
View index.html
//Composite Pattern
//component
interface Component{
add(child:Component):bool;
remove(child:Component):bool;
getChildren():Component[];
getName():string;
isItem():bool;
}
View gist:4993811
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