Skip to content

Instantly share code, notes, and snippets.

View mg's full-sized avatar

Magnús Örn Gylfason mg

View GitHub Profile
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 / 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({
@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'])
});
mod.directive('', function() {
return {
restrict: 'AE',
priority: ,
template: '',
templateUrl: '.html',
replace: ,
transclude: ,
scope: ,
controller: function($scope, $element, $attrs, $transclude, INJECTABLES) { },
angular.module('').factory('', function() {
var service = {
};
return service;
});
### 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:
items := make(map[string]interface{})
items["Sources"] = ghsources
items["SourcesIndex"] = sourceindex
items["UserName"] = u.String()
items["UserLogoutUrl"], _ = user.LogoutURL(c, "/")
if err = t.ExecuteTemplate(w, "admin.thtml", items); err != nil {
http.Error(w, err.Error(), http.StatusInternalServerError)
}
func NewSetFromSlice(s interface{}) Set {
a := NewSet()
slice := reflect.ValueOf(s)
for i := 0; i < slice.Len(); i++ {
a.Add(slice.Index(i).Interface())
}
return a
}
@mg
mg / lipm
Created November 27, 2013 12:44
(function($) {
window.LI = $.extend(window.LI || {}, {exec: function(m, a, s, e) {
jQuery.when(jQuery.ajax({type: 'POST',url: '/Services/MethodProxy.asmx/Execute',data: '{"methodName":"' + m + '","args":' + (a.toJSON ? a.toJSON() : JSON.stringify(a)) + '}',contentType: 'application/json;charset=ISO-8859-1',dataType: 'json')
.then(
function(r) { s(r.d); },
function(r) {
if (r.responseText == '')
return;
var x = JSON.parse(r.responseText);
if (x.Stacktrace) {
@mg
mg / powerset.pl
Last active December 24, 2015 04:59
The Devils code
#!/usr/bin/perl
sub sos_as_string ($;$) {
my ( $set, $string ) = @_;
$$string .= '{';
my $i;
foreach my $key ( keys %{ $set } ) {
$$string .= ' ' if $i++;
if ( ref $set->{ $key } ) {