Skip to content

Instantly share code, notes, and snippets.

View mg's full-sized avatar

Magnús Örn Gylfason mg

View GitHub Profile
### Keybase proof
I hereby claim:
* I am mg on github.
* I am mg (https://keybase.io/mg) on keybase.
* I have a public key whose fingerprint is 0466 113F C1EA EAE6 0FC2 FFB2 0D69 E072 E71D BA75
To claim this, I am signing this object:
angular.module('').factory('', function() {
var service = {
};
return service;
});
mod.directive('', function() {
return {
restrict: 'AE',
priority: ,
template: '',
templateUrl: '.html',
replace: ,
transclude: ,
scope: ,
controller: function($scope, $element, $attrs, $transclude, INJECTABLES) { },
@mg
mg / angular-directive-spec
Last active August 29, 2015 13:59
angular-directive-spec
describe('Testing directive', function () {
var element, scope, serviceMock;
beforeEach(function() {
angular.module('ngMyPackageMocks', [])
.service('Service', function() {
serviceMock= this;
});
angular.module('Test', ['ngMyPackage', 'ngMyPackageMocks'])
});
@mg
mg / famous-view.js
Last active August 29, 2015 14:00
famous-view
define(function(require, exports, module) {
'use strict';
var View = require('famous/core/View');
var Surface = require('famous/core/Surface');
function TheView() {
View.apply(this, arguments);
var surface = new Surface({
function Output(A::Float64, L::Float64, K::Float64, b::Float64)
return A * K^b * L^(1-b)
end
function Invest(O::Float64, s::Float64)
return s * O
end
function Machines(M::Float64, I::Float64, d::Float64)
return M + I - d*M
@mg
mg / gist:d77de48cbca4b43e16e9
Created September 2, 2014 13:09
AngularJS/ToddMotto
// http://toddmotto.com/opinionated-angular-js-styleguide-for-teams/
(function() {
/**
* Describe controller
*
* @param $scope
* @param p1
* @constructor
*/
@mg
mg / obj.js
Created December 22, 2014 10:45
function prop(obj, name, get, set) {
var base= name.substr(0,1).toUpperCase() + name.substr(1);
if(!get) {
get= function() {
return this['_' + name];
};
}
if(!set) {
set= function(v) {
@mg
mg / unixcommands
Created January 25, 2015 21:25
Unix commands
# go sloc
find . -name "*.go" | grep -v test.go | xargs wc -l | sort -n
@mg
mg / rxsnippets.js
Last active August 29, 2015 14:15
Rx.js snippets
/*
Drag & Drop
*/
var parent= document.getElementById('parent');
var widget= document.getElementById('widget');
var mouseDowns= Observable.fromEvent(widget, 'mousedown');
var parentMouseMoves= Observable.fromEvent(parent, 'mousemove');
var parentMouseUp= Observable.fromEvent(parent, 'mosueup');