Skip to content

Instantly share code, notes, and snippets.

View mhevery's full-sized avatar

Miško Hevery mhevery

View GitHub Profile
<!doctype html>
<html xmlns:ng="http://angularjs.org">
<script type="text/javascript" ng:autobind src="http://code.angularjs.org/0.9.10/angular-0.9.10.js"></script>
<script>
function MyApp(){
this.columns = ['name', 'description', 'amount'];
this.rows = [
{name:'name 0', description:'desc 0', amount:123},
{name:'name 1', description:'desc 1', amount:123},
{name:'name 2', description:'desc 2', amount:123},
<html>
<head>
<script src="http://code.angularjs.org/angular-0.9.13.js" ng:autobind></script>
<script>
function MyCntrl() {
this.list_of_items = ['this', 'that', 'the other'];
this.foo = {choice:'that'};
}
MyCntrl.prototype = {
loadData: function(){
<html>
<head>
<script src="http://code.angularjs.org/angular-0.9.13.js" ng:autobind></script>
<script>
function MyCntrl($defer) {
var self = this;
this.list_of_items = ['this', 'that', 'the other'];
self.foo = {choice:''};
$defer(function(){
self.foo = {choice:'that'};
@mhevery
mhevery / gist:1590590
Created January 10, 2012 19:15
Demonstration of jsFiddle resource bug
<html>
<body>
<form class="jsfiddle" method="post" action="http://jsfiddle.net/api/post/library/pure/" target="_blank">
<textarea name="resources">http://code.angularjs.org/angular-0.10.5.min.js</textarea>
<textarea name="css"></textarea>
<input type="text" name="title" value="AngularJS Live Example">
<textarea name="html">&lt;div ng:app&gt;
&lt;div ng:controller="HelloCntl"&gt;
Your name: &lt;input type="text" ng:model="name" value="World"/&gt;
&lt;hr/&gt;
<!doctype html>
<html xmlns:ng="http://angularjs.org" ng:app>
<script src="http://docs-next.angularjs.org/angular-0.10.6.min.js"></script>
<script>
function MainCntl($route, $routeParams, $location) {
this.$route = $route;
this.$location = $location;
this.$routeParams = $routeParams;
$route.when('/Book/:bookId', {template: 'examples/book.html', controller: BookCntl});
@mhevery
mhevery / angular-issue-1051.html
Created June 13, 2012 18:37
angular-issue-1051
<html ng-app>
<head>
<script type="text/javascript" src="http://code.angularjs.org/1.0.0rc12/angular-1.0.0rc12.min.js"></script>
<script>
function Test($scope, $location) {
$scope.away = 'away';
}
</script>
</head>
<body ng-controller="Test">
When you go to bleeding edge you should change to:
@NgController {
selector: '[ng-controller=AppointmentCtrl]',
publishAs: 'ctrl'
}
class AppointmentCtrl {
String appointmentText = '';
List appointments = [{'time': '08:00', 'title': 'Wake Up'}];
#!/bin/sh
curl http://storage.googleapis.com/dart-archive/channels/dev/release/latest/editor/darteditor-macos-x64.zip > ~/Downloads/darteditor-macos-64-dev.zip;
echo Fetched new dart version $(unzip -p ~/Downloads/darteditor-macos-64-dev.zip dart/dart-sdk/version)
rm -rf /Applications/dart-dev ;
unzip ~/Downloads/darteditor-macos-64-dev.zip -d /tmp > /dev/null
mv /tmp/dart /Applications/dart-dev
curl http://storage.googleapis.com/dart-archive/channels/stable/release/latest/editor/darteditor-macos-x64.zip > ~/Downloads/darteditor-macos-64.zip;
echo Fetched new dart version $(unzip -p ~/Downloads/darteditor-macos-64.zip dart/dart-sdk/version)
rm -rf /Applications/dart ;
@mhevery
mhevery / example.ts
Last active June 1, 2017 08:06
Angular2: NgProbe Design
// https://gist.github.com/mhevery/4b1bdb59a8c16f9cbe76
/// <reference path="probe.d.ts" />
///////////////////////
/// WORK IN PROGRESS //
///////////////////////
var appRef: ApplicationRef = ng.platform.applications[0];
@mhevery
mhevery / examples.md
Last active July 27, 2017 09:08
TC39 Zone API Proposal

Monkey patching common browser APIs

Here is an example of how browser APIs could be patched to take advantage of Zone propagation.

setTimeout

Ideally we would not need to do this, since the browser would do this for us.

window.setTimeout = ((delegate) => {