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
namespace = (function (global) { | |
return function (namespace) { | |
var splitted = namespace.split("."); | |
return _.reduce(splitted, function(prev, next) { | |
if (!prev[next]) prev[next] = { }; | |
return prev[next]; | |
}, global); | |
}; | |
})(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
// http://en.wikipedia.org/wiki/Conway's_Game_of_Life | |
var Game = { | |
init: function (options) { | |
this.grid = new Grid(options); | |
}, | |
putCell: function (x, y, state) { | |
this.grid.putCell(x, y, state); |
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
// Trying out the performance difference between look up document by interger field | |
// or string one. | |
// | |
// The test shows that there is either almost no difference, or look up by string field | |
// works even a bit better. | |
// | |
// How can it be explained? | |
// | |
// Output sample: | |
// benchmarking started... |
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 Feedback = Backbone.Model.extend({ | |
url: '/feedback', | |
defaults: { | |
'email': '', | |
'website': '', | |
'feedback': '' | |
}, |
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 BaseModel = Backbone.Model.extend({ | |
defaults: { | |
region: 'kiev', | |
operation: 'sell', | |
type: 'appartment', | |
marketSegment: 'lux' | |
} | |
}); |
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
// missed second parameter - buffer of byte, callback function passed instead.. | |
fs.writeFile('uploads/' + image.name, function(err) { | |
if (err) { | |
return next(err); | |
} | |
res.redirect('back'); | |
}); | |
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 Feedback = Backbone.Model.extend({ | |
url: '/feedback', | |
validate: function (attrs) { | |
var errors = []; | |
if (!attrs.email || attrs.email === '') { | |
errors.push({name: 'email', message: 'Please fill email field.'}); | |
} |
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
Vagrant::Config.run do |config| | |
config.vm.box = "lucid32" | |
config.ssh.forward_agent = true | |
config.vm.forward_port 3000, 3000 | |
# allow for symlinks in the app folder | |
config.vm.customize ["setextradata", :id, "VBoxInternal2/SharedFoldersEnableSymlinksCreate/app", "1"] | |
config.vm.customize ["modifyvm", :id, "--memory", 512, "--cpus", 1] | |
config.vm.provision :chef_solo do |chef| |
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
C:\Development\Projects\experiments\oak\Blog>rake | |
"C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\msbuild.exe" "Blog.sln" /verbosity:quiet /nologo | |
C:\Development\Projects\experiments\oak\Blog\Blog\Blog.csproj(144,3): error MSB4019: The imported project "C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v10.0\WebApplications\Microsoft.WebApplication.targets" was not found. Confirm that the path in the <Import> declaration is correct, and that the file exists on disk. | |
C:\Development\Projects\experiments\oak\Blog\Blog\Blog.csproj(144,3): error MSB4019: The imported project "C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v10.0\WebApplications\Microsoft.WebApplication.targets" was not found. Confirm that the path in the <Import> declaration is correct, and that the file exists on disk. | |
C:\Development\Projects\experiments\oak\Blog\Blog.UITests\Blog.UITests.fsproj(39,3): error MSB4019: The imported project "C:\Program Files (x86)\Microsoft F#\v4.0\Microsoft.FSharp.Targets" was not found. Confirm that the p |
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
[ { id: 7744300, | |
name: 'Buttons', | |
full_name: 'alexwolfe/Buttons', | |
owner: | |
{ login: 'alexwolfe', | |
id: 407237, | |
avatar_url: 'https://secure.gravatar.com/avatar/5248e75ab0de8f30d818956c657be0f9?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-user-420.png', | |
gravatar_id: '5248e75ab0de8f30d818956c657be0f9', | |
url: 'https://api.github.com/users/alexwolfe', | |
html_url: 'https://github.com/alexwolfe', |