Skip to content

Instantly share code, notes, and snippets.

View danilodeveloper's full-sized avatar
🤙
Building things

Danilo Barsotti danilodeveloper

🤙
Building things
View GitHub Profile
@jamarparris
jamarparris / Generate Mongo Object ID in PostGres
Last active March 20, 2024 00:04
Create ObjectIds in PostGres following the MongoDB semantics. Very similar to the Instagram approach linked below.http://docs.mongodb.org/manual/reference/object-id/http://instagram-engineering.tumblr.com/post/10853187575/sharding-ids-at-instagram
The MIT License (MIT)
Copyright (c) 2013 Jamar Parris
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE S
@ericelliott
ericelliott / essential-javascript-links.md
Last active October 4, 2024 20:52
Essential JavaScript Links
@danilodeveloper
danilodeveloper / gist:784c679216efddd8f08d
Last active August 29, 2015 14:24
Herança no Javascript usando new e Object.create
// http://jsfiddle.net/0s8kzoke/
console.log('----VEHICLE DEFINITION----');
function Vehicle(name, model, speedLimit) {
// prevent the scope error when the programmer forgot the
// 'new' keyword before call the constructor.
if (!(this instanceof Vehicle)){
return new Vehicle(name, model, speedLimit);
}