- Update
package.json
, setversion
to a prerelease version, e.g.2.0.0-rc1
,3.1.5-rc4
, ... - Run
npm pack
to create package - Run
npm publish <package>.tgz --tag next
to publish the package under thenext
tag - Run
npm install --save package@next
to install prerelease package
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
// 1. trimming and padding | |
// https://github.com/tc39/proposal-string-left-right-trim | |
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/TrimLeft | |
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/padStart | |
console.log(" 123 ".trim() === "123"); // true | |
console.log(" 123 ".trimStart() === "123 "); // true | |
console.log(" 123 ".trimEnd() === " 123"); // true | |
console.log("123".padStart(6, "0")); // 000123 |
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
// Copied from: https://ethfiddle.com/09YbyJRfiI | |
// CryptoKitties Source code | |
// Copied from: https://etherscan.io/address/0x06012c8cf97bead5deae237070f9587f8e7a266d#code | |
pragma solidity ^0.4.11; | |
/** | |
* @title Ownable | |
* @dev The Ownable contract has an owner address, and provides basic authorization control |
Abbreviation: desc
Template text:
describe("$description$", function () {
it("should $it$", function () {
$content$
});
});
You don't really need a framework or fancy cutting-edge JavaScript features to do two-way data binding. Let's start basic - first and foremost, you need a way to tell when data changes. Traditionally, this is done via an Observer pattern, but a full-blown implementation of that is a little clunky for nice, lightweight JavaScript. So, if native getters/setters are out, the only mechanism we have are accessors:
var n = 5;
function getN() { return n; }
function setN(newN) { n = newN; }
console.log(getN()); // 5
setN(10);
(by @andrestaltz)
If you prefer to watch video tutorials with live-coding, then check out this series I recorded with the same contents as in this article: Egghead.io - Introduction to Reactive Programming.
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
// This event emitter emits events, but reserves the right to publish events to | |
// for its creator. It uses a WeakMap for true encapsulation. | |
const eesToEventMaps = new WeakMap(); | |
export default class EventEmitter { | |
constructor(publisher) { | |
const eventMap = Object.create(null); | |
eesToEventMaps.set(this, eventMap); |
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
alias gityolo='git commit -am "DEAL WITH IT" && git push -f origin master' |
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
Look at the README. |
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
// Mocked Service | |
angular.module('mock.users', []). | |
factory('UserService', function($q) { | |
var userService = {}; | |
userService.get = function() { | |
return { | |
id: 8888, | |
name: "test user" | |
} |
NewerOlder