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 WebSocket = require('ws') | |
var io = require('socket.io-client'); | |
var MongoClient = require('mongodb').MongoClient; | |
console.log("Building websocket"); | |
ws = io.connect('https://socketio.mtgox.com/mtgox') | |
console.log(ws); |
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
// FOUND IN src/java/com/andymoreland/GoogleSpreadsheet/ | |
package com.andymoreland.GoogleSpreadsheet; | |
import java.io.IOException; | |
import java.net.URL; | |
import java.util.List; | |
import com.google.gdata.client.Service; | |
import com.google.gdata.client.spreadsheet.SpreadsheetService; |
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 html = require('fs').readFileSync(__dirname+'/index.html'); | |
var fs = require('fs'); | |
var server = require('http').createServer(function(req, res){ | |
res.end(html); | |
}); | |
server.listen(8080); |
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
$( function () { | |
var ws = new WebSocket("ws://localhost:3001/sockjs/websocket"); | |
ws.onopen = function() { | |
ws.send('{"msg":"connect","id":"1"}'); | |
ws.send('{"msg":"method","method":"pageHit","params":["'+window.location.href+'","'+document.referrer+'","'+document.title+'"],"id":"2"}'); | |
ws.close(); | |
} | |
} |
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
|------------------------------ | |
| \ | | |
| \ x x \ \ G | | |
| \ \ \ | | |
| \ x x \ \| | |
|\ \ \ | | |
| \ \ x x \ | | |
| \ \ x x \ | | |
| \ \ \ | | |
| G \ \ \ | |
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
Let's assume optimal strategy. If there is only one stack, then the first player to move can win if he wants to by taking all of the stones. IF both players want to lose, then the first player still wins because the second player can take all of the stones except for one that the first player leaves. | |
Okay, so how does this transfer to a two stack game? | |
The first person to make a move on the last stack remaining wins. | |
So basically, if you want to win, you need to lose the first stack. | |
As shown above, the first player always wins the first stack, regardless of his decision. |
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
$.post(this.action+ ".js", data).complete(function () { alert("yo?"); }).success( | |
function () { | |
alert("Hello"); | |
$(this).parent().hide().prev("tr").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
this.model.save().success( _.bind(function(){ | |
console.log("Success finished"); | |
var foo = $(this.el); | |
console.log("Found the element"); | |
foo.fadeOut(500, _.bind(function(){ | |
console.log("Starting fade"); | |
this.model.collection.fetch(); | |
$(this.el).remove(); | |
}, this)); | |
}, this)); |
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
context.clearRect 0, 0, window.innerWidth - 10, window.innerHeight - 30 | |
for _, t of @list | |
t.paint() |
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
l = (msg) -> | |
console.log msg | |
$ -> | |
class Triangle | |
constructor: (@context) -> | |
@paint() | |
@x = 0 | |
@y = 0 | |
@xdir = 0 | |
@ydir = 0 |