This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import "log" | |
type Object struct { | |
} | |
func (o Object) value() { | |
log.Println(o, "call value receiver") | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.*; | |
class EnumPractice{ | |
private enum singleton{ | |
INSTANCE; | |
public void show(){ | |
System.out.println("enum show"); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var a = (function(){ | |
return 100; | |
}()); | |
var b = { | |
o: (function(){ | |
var local = 100; | |
return local * 2; | |
}()) | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
describe('decorator', function() { | |
// body... | |
it('singleton1', function(done) { | |
var Car = function(){ | |
var instance = this; | |
this.a = 100; | |
Car = function(){ | |
return instance; | |
}; | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$(document).ready(function() { | |
var models = { | |
names: ko.observableArray([ | |
{"name": "name1"}, | |
{"name": "name2"} | |
]) | |
}; | |
ko.applyBindings(models); | |
setTimeout(function(){ |
OlderNewer