Skip to content

Instantly share code, notes, and snippets.

View satoshun's full-sized avatar
🤖

Sato Shun satoshun

🤖
View GitHub Profile
@satoshun
satoshun / gist:5128329
Created March 10, 2013 12:12
social intent
package com.example.mysocialintent.test;
import android.app.Activity;
import android.content.Intent;
import android.test.ActivityInstrumentationTestCase2;
import com.example.mysocialintent.MainActivity;
import com.example.mysocialintent.libs.MySocialIntent;
package com.example.mysocialintent.libs;
import java.io.UnsupportedEncodingException;
import java.net.URLDecoder;
import android.app.Activity;
import android.content.Intent;
public enum MySocialIntent {
import java.util.*;
class EnumPractice{
private enum singleton{
INSTANCE;
public void show(){
System.out.println("enum show");
}
}
var a = (function(){
return 100;
}());
var b = {
o: (function(){
var local = 100;
return local * 2;
}())
};
@satoshun
satoshun / test_singleton.js
Created March 23, 2013 03:57
javascript singleton
describe('decorator', function() {
// body...
it('singleton1', function(done) {
var Car = function(){
var instance = this;
this.a = 100;
Car = function(){
return instance;
};
};
@satoshun
satoshun / test_iterator.js
Created March 23, 2013 05:48
test iterator
describe('iterator', function() {
it('test', function() {
var Iter = function(data){
this.index = 0;
this.data = data;
};
Iter.prototype = {
next: function(){
var elem = this.data[this.index];
this.index += 1;
@satoshun
satoshun / test_observer.js
Created March 24, 2013 11:41
test observer
describe('design pattern', function () {
var testData = null;
it('observer', function(){
var Observer = function(){
this.subscribers = [];
};
Observer.prototype = {
publish: function(data){
var i = 0,
len = this.subscribers.length;
@satoshun
satoshun / ex_knockout.js
Created March 27, 2013 15:14
knockout js
$(document).ready(function() {
var models = {
name: ko.observable("name")
};
ko.applyBindings(models);
setTimeout(function(){
models.name("HAHAHA");
}, 2000);
});
@satoshun
satoshun / ex_knockout2.js
Created March 27, 2013 15:18
knockoutjs
$(document).ready(function() {
var models = {
names: ko.observableArray([
{"name": "name1"},
{"name": "name2"}
])
};
ko.applyBindings(models);
setTimeout(function(){
@satoshun
satoshun / map.html
Created March 30, 2013 10:13
bomber1
<!DOCTYPE HTML>
<html lang="en-US" ng-app="game">
<head>
<meta charset="UTF-8">
<script type="text/javascript" src="js/vendor/jquery-1.8.0.min.js"></script>
<script type="text/javascript" src="js/angular.js"></script>
<script type="text/javascript" src="js/objects.js"></script>
<script type="text/javascript" src="js/index.js"></script>
<script type="text/javascript" src="js/event.js"></script>
<script type="text/javascript" src="js/map.js"></script>