Skip to content

Instantly share code, notes, and snippets.

Satoshi Murakami satyr

Block or report user

Report or block satyr

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@satyr
satyr / gist:1080268
Created Jul 13, 2011 — forked from zakki/gist:1080130
FizzBuzz Scala 70B
View gist:1080268
for(n<-0 to 99)println(Seq(n+1,"Buzz","Fizz","FizzBuzz")(n%3&2|n%5/4))
@satyr
satyr / README.md
Created May 20, 2011 — forked from yuya-takeyama/README.md
quick sleep sort
View README.md

quick sleep sort

example usage:

$ coffee quicksleepsort.coffee 3701 45 292 9 324 45 23 123 1343
9
23
45
View cowsh.js
// Coco compiler wrapper for WSH
// (must be placed in the same directory as coco.js)
// Usage: cscript cowsh.js [--watch] file
// inspired by http://kennyj-jp.blogspot.com/2011/01/coffeescriptwindows.html
var fs = WScript.CreateObject("Scripting.FileSystemObject");
var scriptPath = WScript.ScriptFullName.slice(
0, -WScript.ScriptName.length);
var Coco = new new Function(
fs.OpenTextFile(scriptPath + "coco.js", 1).ReadAll()
View fib.coffee
crypto = require 'crypto'
key = (values) ->
crypto.createHash('sha1').update(values.join '-').digest 'hex'
memoize = (f, memo = {}) ->
-> memo[key [this, arguments...]] ||= f.apply this, arguments
fib = memoize (n) -> if n < 2 then n else fib(n-1) + fib(n-2)
@satyr
satyr / state-monad.co
Created Apr 22, 2011 — forked from igstan/state-monad.coffee
State Monad in Co{co,ffeeScript}
View state-monad.co
push = (value) -> (stack) -> {value, stack: [value]concat stack}
pop = (stack) -> value: stack.0, stack: stack.slice 1
bind = (stackOperation, continuation) -> (stack) ->
result = stackOperation stack
continuation(result.value) result.stack
result = (value) -> (stack) -> {value, stack}
View sudoku.co
# Sudoku solver in Coco based on the Python solution by Peter Norvig
# http://norvig.com/sudoku.html
# 2011-04-19 jonelf@gmail.com
# 2011-04-21 satyr
#
# Throughout this program we have:
# r is a row, e.g. 'A'
# c is a column, e.g. '3'
# s is a square, e.g. 'A3'
# d is a digit, e.g. '9'
View new-languages.md

"In our study of program design, we have seen that expert programmers control the complexity of their designs with the same general techniques used by designers of all complex systems. They combine primitive elements to form compound objects, they abstract compound objects to form higher-level building blocks, and they preserve modularity by adopting appropriate large-scale views of system structure. In illustrating these techniques, we have used Lisp as a language for describing processes and for constructing computational data objects and processes to model complex phenomena in the real world.

However, as we confront increasingly complex problems, we will find that Lisp, or indeed any fixed programming language, is not sufficient for our needs. *We must constantly turn

View update.coffee
name= if previous_keys.length > 0
then "#{main_key}[#{_.implode('][', previous_keys)}][#{key}]"
else "#{main_key}[#{key}]"
View stickam.ub.js
function StickamLargeChat_old (id) {
var start = "<object width='820' height='490' codebase='http:\/\/fpdownload.macromedia.com\/pub\/shockwave\/cabs\/flash\/swflash.cab#version=8,0,0,0' classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000'>\n" +
"<embed src='http:\/\/player.stickam.com\/flash\/stickam\/stickam_player.swf?app=stickam_chat_open.swf&userID=";
var end="' width='820' height='490' type='application/x-shockwave-flash' quality='high' allowscriptaccess='always' allowfullscreen='true' flashvars='webID=84634C6CDD408CA62D5DBD086DF5E196&webSeq=&userType=205&skinName=open&app=stickam_chat_open.swf&userIP=127.0.0.1&skinType=open&sessionType=115&userSiteID=1015547&autoplay=1&playerID=7334381&langID=en&'>\n" +
"<\/embed><\/object>";
return (start+id+end);
}
function StickamLargeChat(id){
var start = "<object width='320' height='240' codebase='http:\/\/fpdownload.macromedia.com\/pub\/shockwave\/cabs\/flash\/swflash.cab#version=8,0,0,0' classid='clsid:D27CDB6E-AE6D-11cf-96B8-4445535
View twitter-oauth-caution.user.css
@namespace url(http://www.w3.org/1999/xhtml);
@-moz-document
url-prefix(https://twitter.com/oauth/authenticate?),
url-prefix(https://twitter.com/oauth/authorize?),
url-prefix(https://api.twitter.com/oauth/authenticate?),
url-prefix(https://api.twitter.com/oauth/authorize?),
url-prefix(http://twitter.com/oauth/authenticate?),
url-prefix(http://twitter.com/oauth/authorize?),
url-prefix(http://api.twitter.com/oauth/authenticate?),
url-prefix(http://api.twitter.com/oauth/authorize?) {
You can’t perform that action at this time.