(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.
| // Add the following to your preferences file | |
| "folder_exclude_patterns":[".git","node_modules"] |
| #!/bin/sh | |
| echo "[post-rewrite hook: $1]" | |
| # by noahgrant & digitaljhelms | |
| # | |
| # quick script to call "bower install" and "npm install" automatically if | |
| # bower.json or package.json are changed, respectively | |
| # | |
| # this assumes one top-level file for each |
| #/usr/bin/env bash | |
| # MIT © Sindre Sorhus - sindresorhus.com | |
| # forked by Gianluca Guarini | |
| changed_files="$(git diff-tree -r --name-only --no-commit-id ORIG_HEAD HEAD)" | |
| check_run() { | |
| echo "$changed_files" | grep -E --quiet "$1" && eval "$2" | |
| } |
| angular.module('stateMock',[]); | |
| angular.module('stateMock').service("$state", function($q){ | |
| this.expectedTransitions = []; | |
| this.transitionTo = function(stateName){ | |
| if(this.expectedTransitions.length > 0){ | |
| var expectedState = this.expectedTransitions.shift(); | |
| if(expectedState !== stateName){ | |
| throw Error("Expected transition to state: " + expectedState + " but transitioned to " + stateName ); | |
| } | |
| }else{ |
| function formatDuration (seconds) { | |
| return [60, 3600, 86400, 31536000] | |
| .reduceRight(function (results, current) { | |
| var seconds = results.pop(); | |
| results.push(Math.floor(seconds / current)); | |
| results.push(seconds - results[results.length - 1] * current); | |
| return results; | |
| }, [seconds]) | |
| .map(function (value, index) { | |
| var words = ['year', 'day', 'hour', 'minute', 'second']; |
| <!DOCTYPE html> | |
| <html> | |
| <head> | |
| <meta charset="utf-8"> | |
| <title>Angular JS</title> | |
| </head> | |
| <body ng-app="jsbin"> | |
| <div ng-controller="DemoCtrl as demo"> | |
| <h1>Hello {{demo.name}}</h1> | |
| </div> |
(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.
| import { Component } from "React"; | |
| export var Enhance = ComposedComponent => class extends Component { | |
| constructor() { | |
| this.state = { data: null }; | |
| } | |
| componentDidMount() { | |
| this.setState({ data: 'Hello' }); | |
| } | |
| render() { |
| * { | |
| font-size: 12pt; | |
| font-family: monospace; | |
| font-weight: normal; | |
| font-style: normal; | |
| text-decoration: none; | |
| color: black; | |
| cursor: default; | |
| } |