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'); | |
var errorHandler = function(err, result) { | |
return function(customMessage) { | |
if (err) return err; | |
else { | |
// Call some other sync function but with my message | |
console.log(customMessage); | |
handleResult(result); | |
} |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8" /> | |
<title>Your first Backbone.js App | Tutorialzine </title> | |
<!-- Google web fonts --> | |
<link href="http://fonts.googleapis.com/css?family=PT+Sans:400,700" rel='stylesheet' /> | |
</head> |
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'); | |
var Cache = { | |
isFresh: function (file, time, cb) { | |
fs.exists(file, function (exists) { | |
if (!exists) { | |
return cb(null, false); | |
} |
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
'use strict'; | |
var expect = require('expect.js'); | |
function get(object, namespace) { | |
var keys = namespace.split('.'), | |
currentObj = object, | |
current; | |
while (current = keys.shift()) { |
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 MongoClient = require('mongodb').MongoClient, | |
config = require('easy-config'); | |
var DB = function () { | |
function connect (cb) { | |
MongoClient.connect(config.mongodb.url, function (err, db) { | |
if (err) { |
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 Befunge = function () { | |
var WIDTH = 80, | |
HEIGHT = 25, | |
x = 0, | |
y = 0, | |
output = [], // This is array for storing output | |
stack = [], |
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
Imports | |
Imports System.IO | |
Imports System.Text | |
Public Class MainForm | |
Private filePath = My.Computer.FileSystem.SpecialDirectories.MyDocuments & "\settings.txt" | |
Private Sub Chart1_Click(sender As Object, e As EventArgs) |
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 Q = require('q'), | |
fs = require('fs'); | |
Q.longStackSupport = true; | |
var filterLargeFilename = function (array) { | |
var length = 10; | |
return array.filter(function (name) { | |
return (name.length <= length); |
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 crypto = require('crypto'), | |
cuid = require('cuid'), | |
string, | |
zeros = 0, | |
currentHash = '', | |
currentZeros = 0, | |
hash; | |
function findZeros(hash) { | |
var chars = hash.split(''), |
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 VigenèreCipher(key, abc) { | |
var keyLen = key.length, | |
abcLen = abc.length - 1, | |
abcObj, | |
abcToObject; | |
key = key.split(''); | |
abc = abc.split(''); | |
abcToObject = function (abc) { |