This file contains hidden or 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
#include <stdio.h> | |
#include <stdint.h> | |
class A { | |
public: | |
virtual void doThing() { | |
printf("I'm an A\n"); | |
} | |
}; |
This file contains hidden or 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 myApp = angular.module('myApp', []); | |
//service style, probably the simplest one | |
myApp.service('helloWorldFromService', function() { | |
this.sayHello = function() { | |
return "Hello, World!" | |
}; | |
}); | |
//factory style, more involved but more sophisticated |
This file contains hidden or 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
(function (root, factory) { | |
if (typeof define === 'function' && define.amd) { | |
define(['angular'], factory); | |
} else if (typeof exports === 'object') { | |
factory(require('angular')); | |
} else { | |
factory(root.angular); | |
} | |
}(this, function (angular) { | |
'use strict'; |
This file contains hidden or 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
app.directive('outer', function(){ | |
return { | |
restrict: 'E', | |
controllerAs: 'outer', | |
require: 'outer', | |
template: '<p>{{outer.hello}}<p ng-transclude="outerInner"></p><p ng-transclude></p></p>', | |
scope: true, | |
transclude: { | |
outerInner: 'inner' | |
}, |
This file contains hidden or 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
app.controller('MainCtrl', function($scope) { | |
$scope.clickedTimes = 0; | |
$scope.prop1 = 2+3; | |
// $scope.prop2 = 'scope_prop2'; | |
// $scope.aNumber = 44; | |
// $scope.obj = { prop1: "obj_prop1"} | |
$scope.changeProperties = function() { | |
$scope.prop1.prop1 = 'scope_prop1_changed after ' + ($scope.clickedTimes++) + ' clicks'; |
This file contains hidden or 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
if (typeof define === "function" && define.amd) this.d3 = d3, define(d3); else if (typeof module === "object" && module.exports) module.exports = d3; else this.d3 = d3; |
This file contains hidden or 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 gen = function *(count){ | |
console.log("gen called: ", count); | |
if (count < 20) | |
yield count; | |
else | |
yield *gen(count/2); | |
} | |
var g = gen(100); | |
do { | |
var n = g.next(); |
This file contains hidden or 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 gen = function *(count){ | |
console.log("gen called: ", count); | |
if (count < 20) | |
yield count; | |
else | |
yield *gen(count/2); | |
} | |
var g = gen(100); | |
do { | |
var n = g.next(); |
This file contains hidden or 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
/* Lorem Ipsum Generator | |
* (CC-BY) Fredrik Bridell <[email protected]> 2009 | |
* Version 0.21 - multilingual | |
* Released under a Creative Commons Attribution License | |
* | |
* You are welcome to use, share, modify, print, frame, or do whatever you like with this | |
* software, including commercial use. My only request is that you tell the world where you found it. | |
* | |
* One way is to include the phrase: | |
* "Using the The Lorem Ipsum Generator by Fredrik Bridell (http://bridell.com/loremipsum/)" |
This file contains hidden or 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
#import <UIKit/UIKit.h> | |
@interface ViewController : UIViewController <UITableViewDelegate, UITableViewDataSource> | |
@property (weak, nonatomic) IBOutlet UITableView *tableView; | |
@property (strong, nonatomic) NSMutableArray *data; | |
@end |