Skip to content

Instantly share code, notes, and snippets.

View alexanderjeurissen's full-sized avatar

Alexander Jeurissen alexanderjeurissen

View GitHub Profile
#!/bin/bash
# original author of this snippet: Esjee
monitor=`xrandr | grep -i edp | cut -d " " -f 1`
xrandr --newmode "1440x900_60.00" 106.50 1440 1528 1672 1904 900 903 909 934 -hsync +vsync
xrandr --addmode $monitor 1440x900_60.00
xrandr --output $monitor --mode 1440x900_60.00
@alexanderjeurissen
alexanderjeurissen / browse
Last active January 28, 2017 13:36
Fuzzy select a Arcanist differential to either browse or land
browse() {
case $1 in
acc)
diffs=`arc list | grep 'Accepted' | egrep -o 'D\d+: .*'`
;;
rev)
diffs=`arc list | grep 'Needs Review' | egrep -o 'D\d+: .*'`
;;
function generateAlphaNumericLabels(amount) {
var labels = [];
for (var i = 0; i <= amount; i++) {
var appendNumber = 0;
var offset = 0;
if (i > 25 && i <= 34) {
appendNumber = i - 25;
labels.push(String.fromCharCode(65 + offset) + appendNumber);
@alexanderjeurissen
alexanderjeurissen / Git flow test.md
Last active April 11, 2016 19:37
Git flow test

#Git-flow tutorial

by Alexander Jeurissen

I created a test repository on Github to check if git-flow can aid in keeping a clean branch model. In the steps below you can see how I create a new feature and release containing our new feature.

  1. Create remote repository on Github
  2. Clone de remote repo with git clone
  3. Init git flow with defaults: git flow init -d

result:

@alexanderjeurissen
alexanderjeurissen / stringToPastel.js
Last active January 2, 2016 07:49
String to pastelcolor script. If added to your project you can simply use: "string to be converted".getPastel(); to convert the string to a pastel color.
String.prototype.getPastel = function (rgb) {
var radix = (!rgb) ? 16 : 10;
var hashCode = this.split("").reduce(function (a, b) {
a = ((a << 5) - a) + b.charCodeAt(0);
b = ((b << 5) - b) + a;
return a << b;
}, 0);
var rad = function (bitshift) {
@alexanderjeurissen
alexanderjeurissen / reverse string prototype
Created January 5, 2014 17:04
In javascript the fastest way to reverse a string is to first create a Char array , then reverse the array then join it. In a recent project i wanted to revert strings and didn't want to duplicate "string value".split("").reverse().join(""); therefore i created a String.prototype so i can just call "string value".reverse();
String.prototype.reverse = function () {
return this.split("").reverse().join("");
}
public string pastelColorForString (string s) {
UInt32 hashCode = BitConverter.ToUInt32 (
new SHA1CryptoServiceProvider ().ComputeHash (
Encoding.UTF8.GetBytes (s)
),0
);
return "#" +
((((hashCode >> 24) & 0xFF)+255)/2).ToString ("X") +
((((hashCode >> 16) & 0xFF)+255)/2).ToString ("X") +
var hashCode = function(s) {
return s.split("").reduce(function(a, b) {
a = ((a << 5) - a) + b.charCodeAt(0);
return a & a
}, 0);
}
import Ember from 'ember';
import FilterSelectMixin from 'applicationfilter-select';
const {RSVP} = Ember;
export default Ember.Controller.extend(FilterSelectMixin, {
search: '',
filter: '',
queryParams: ['search', 'filter'],
sortAscending: false,
//GistID:1c45ca694ad333baeddd
'use strict';
angular.module('stateMock', []);
angular.module('stateMock').service("$state", function($q) {
this.expectedTransitions = [];
this.current = {};
this.transitionTo = function(stateName) {
if (this.expectedTransitions.length > 0) {
var expectedState = this.expectedTransitions.shift();