Skip to content

Instantly share code, notes, and snippets.

@karl-gustav
karl-gustav / Grunt.js
Last active August 29, 2015 14:05
Why Grunt sux and Gulp rules:
grunt.initConfig({
curl: {
'/tmp/myDonwloadedFile.tar.gz': 'https://gitlab.fronter.net/facilitation/selenium-browser-drivers/raw/master/v1.0.0.tar.gz',
},
untar: {
options: {
mode: 'tgz'
},
files: {
'selenium/browser-drivers': '/tmp/myDonwloadedFile.tar.gz'
### Keybase proof
I hereby claim:
* I am karl-gustav on github.
* I am karlgustav (https://keybase.io/karlgustav) on keybase.
* I have a public key whose fingerprint is 6CBC A750 D860 357D 7A36 5E62 4869 69E5 E7D5 5A76
To claim this, I am signing this object:
@karl-gustav
karl-gustav / [] template
Created October 22, 2014 12:06
[] template
app.directive("myDirective", function(){
return {
restrict: "EA",
scope: {
name: "@",
color: "=",
reverse: "&"
},
template: [
"<div class='line'>",
// someController.js
angular
.module('app')
.controller('SomeController' , SomeController);
function SomeController() { }
// someController.js
angular
.module('app')
.controller('SomeController', function () { });
// someController.js
angular
.module('app')
.controller('SomeController', function SomeController () { });
@karl-gustav
karl-gustav / gist:0e806fc9242b8e9c847c
Last active August 29, 2015 14:11
Spanish word of the day
@karl-gustav
karl-gustav / string-extras.js
Created January 2, 2015 13:45
Highly performant ES6 String extras polyfills for modern browsers.
if (!('startsWith' in String.prototype))
Object.defineProperty(String.prototype, 'startsWith', {
value: function (searchString, position) {
if (Object.prototype.toString.call(searchString) === "[object RegExp]")
throw new TypeError("The search string cannot be a regular expression.");
if (position === undefined)
position = 0;
else
position = Math.min(Math.max(position, 0), this.length);
return this.lastIndexOf(searchString, position) === position;
'use strict';
var fs = require('fs'),
request = require('request'),
crypto = require('crypto'),
filePath = __dirname + '/frontend-src/po/translation-blueprints.pot',
translationBlueprints = fs.readFileSync(filePath),
hash = crypto.createHash('md5').update(translationBlueprints).digest('hex'),
url = 'http://translations.fronter.net/zanata/rest/file/source/login-service/master?docId=translation-blueprints',
formData = {
hash: hash,
@karl-gustav
karl-gustav / zanata-helper.js
Last active August 29, 2015 14:24
class for working with zanata
'use strict';
var request = require('request'),
toFile = require('vinyl-source-stream'),
toBuffer = require('vinyl-buffer'),
mergeStream = require('merge2'),
ZANATA_USER = {
USERNAME: '<place username here>',
TOKEN: '<place token here>'
};