Skip to content

Instantly share code, notes, and snippets.

Avatar

Eirik Brandtzæg eirikb

View GitHub Profile
@eirikb
eirikb / dep.js
Created Jun 24, 2014
Dependencyhackjection
View dep.js
var d={a:1,b:2},f=function(a,b){return a+b};f.apply(null,(''+f).match(/function[^(]*\(([^)]*)\)/)[1].split(/,\s*/).map(function(x){return d[x]}))
@eirikb
eirikb / paging.html
Created Nov 16, 2014
SharePoint paging
View paging.html
<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.1/css/bootstrap.min.css">
<script src="//cdnjs.cloudflare.com/ajax/libs/underscore.js/1.7.0/underscore-min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/angular.js/1.3.0/angular.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/angular.js/1.3.0/angular-sanitize.min.js"></script>
<div ng-app="test-paging" ng-controller="ListController">
<table class="table table-bordered">
<tr ng-repeat="item in items">
<td>{{item.Title}}</td>
<td ng-bind-html="item.Body"></td>
</tr>
View example.js
var nodify = require('nodify');
// Prints build time
console.log(nodify(function() {
return new Date();
}));
// Prints current time
console.log(new Date());
View OpenBinaryDirect.cs
public static FileInformation GetFile(ClientContext clientContext, string fileRef)
{
using (var clientContextHack = new ClientContext(clientContext.Url))
{
return File.OpenBinaryDirect(clientContextHack, fileRef);
}
}
View browser.js
function fail() {
omg / lol;
};
$(function() {
DNode().connect(function(remote) {
remote.hello(function() {
fail();
});
});
});
View gist:1231414
git filter-branch -f --commit-filter '
if [ "$GIT_AUTHOR_NAME" = "eirikb@heavyload" ];
then
GIT_COMMITTER_NAME="<Eirik Brandtzæg>";
GIT_AUTHOR_NAME="<Eirik Brandtzæg>";
GIT_COMMITTER_EMAIL="<eirikb@eirikb.no>";
GIT_AUTHOR_EMAIL="<eirikb@eirikb.no>";
git commit-tree "$@";
else
git commit-tree "$@";
View gist:1264580
$ mvn clojure:test
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building comicparser 0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- clojure-maven-plugin:1.3.4:test (default-cli) @ comicparser ---
Testing no.eirikb.comicparser.comicparser
View gist:1296912
{
"image":{
"operatingSystem":{
"family":"UBUNTU",
"arch":"paravirtual",
"version":"",
"description":"DB2 Express-C 9.7.1 on Ubuntu 9.10 i386 - 20100407",
"is64Bit":false
},
"description":"DB2 Express-C 9.7.1 running on Ubuntu 9.10. Built 2010-04-07",
View helloworld.lett
my.test-lib: {
a: 'hello',
b: 'world',
c: 1337,
t: true,
f: false,
inner.object: 'Works!',
my.very-inner.object: 7,
nesting-test: +(1 2 3 -(6 1)),
string-test: str('hello' ', ' 'world'),
View gist:1333699
[eirikb@eeeirik mineserver2]$ cmake .
CMake Error at /usr/share/cmake-2.8/Modules/FindBoost.cmake:1197 (message):
Unable to find the requested Boost libraries.
Unable to find the Boost header files. Please set BOOST_ROOT to the root
directory containing Boost or BOOST_INCLUDEDIR to the directory containing
Boost's headers.
Call Stack (most recent call first):
CMakeLists.txt:59 (FIND_PACKAGE)
You can’t perform that action at this time.