This file contains hidden or 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 toList = function (value) { | |
| return Array.isArray(value) ? value : [value]; | |
| }; | |
| var range = function (from, to) { | |
| var result = []; | |
| for (var i = from; i <= to; i ++) { | |
| result.push(i); | |
| } |
This file contains hidden or 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(){ | |
| $("span#search_box").click( | |
| function(){ | |
| if ($("span#search").css("display") == "none"){ | |
| $("span#search").slideDown("nomal"); | |
| } | |
| else { | |
| $("span#search").slideUp("nomal"); | |
| } | |
| }); |
This file contains hidden or 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 routes = require('./routes'); | |
| // 中略 | |
| app.get('/', routes.index); | |
| app.get('/topics/', routes.topics.index); | |
| app.get('/topics/:topic_id', routes.topics.show); | |
| app.get('/topics/:topic_id/posts/:post_id', routes.topics.post.show); |
This file contains hidden or 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 fs = require('fs'); | |
| function putStrLn (m) { | |
| return function (cb) { | |
| if (m) { | |
| m(function (str) { | |
| console.log(str); | |
| cb(); | |
| }); | |
| } else { |
This file contains hidden or 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 fs = require('fs'); | |
| function readFile (filename) { | |
| return function () { | |
| fs.readFile(filename, 'utf8', arguments.callee.next); | |
| } | |
| } | |
| function getData() { | |
| return function (err, data) { |
This file contains hidden or 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
| some |
This file contains hidden or 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 compose () { | |
| return Array.prototype.reduce.call(arguments, function (f, g) { | |
| return function (x) { | |
| return f(g(x)); | |
| } | |
| }); | |
| } |
This file contains hidden or 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
| #1bit + 1bit の加算回路(XOR) | |
| -C(R1 L)A-B(R2 L)C-A(L1)C- | |
| (R1 L)B-A(R2 L) | |
| -C(R1 R)A-C(R2 R)A-A(L2)C- | |
| #ハンドアセンブルしたもの | |
| ['VCC', 'R1LC'] | |
| ['R1LA', 'R2LB'] | |
| ['R2LC', 'L1A'] | |
| ['L1C', 'GND'] |
This file contains hidden or 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 http = require('http'); | |
| var maxConnections = 1000, maxRequests = 10000; | |
| var connections = 0, requests = 0, errors = 0, done = 0; | |
| var options = { | |
| host: 'target', | |
| port: 80, | |
| path: '/' |
This file contains hidden or 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
| fizzbuzz = (num) -> | |
| if num % 15 == 0 then 'FizzBuzz' | |
| else if num % 3 == 0 then 'Fizz' | |
| else if num % 5 == 0 then 'Buzz' | |
| else num | |
| console.log (fizzbuzz num for num in [1..100]).join('\n') |