Skip to content

Instantly share code, notes, and snippets.

{
"data": [
{
"id": {
"@type": "g:Int64",
"@value": 12336
},
"label": "vertex",
"inE": {
"relates": [
@swissmanu
swissmanu / eventually.ts
Last active February 15, 2018 08:23
Typed eventually construct using TypeScript and Promises
// Example Usage:
eventually(20)(() => fetch('http://i.fail.often.com/data.json'))
.then(data => console.log(data))
.catch(e => console.log(e));
function eventually<T>(
giveUpAfterNumberOfRetries: number,
nextInterval: (numberOfRetries: number) => number = linearRetryInterval
) {
@swissmanu
swissmanu / functional.js
Last active December 7, 2017 14:55
Array juggling in JavaScript with functional programming approach
// precondition: xs is always an array
function head(xs) {
if (xs.length === 0) return null
return xs[0]
}
function tail(xs) {
return xs.slice(1)
}
#!/bin/sh
BOLD=$(tput BOLD)
NORMAL=$(tput sgr0)
RED='\033[0;31m'
LOCAL_SETTINGS_BASE=~/Library/Application\ Support/Code
LOCAL_SETTINGS="${LOCAL_SETTINGS_BASE}/User"
REMOTE_SETTINGS=~/Google\ Drive/App\ Sync/vscode/Settings

Keybase proof

I hereby claim:

  • I am swissmanu on github.
  • I am alabor (https://keybase.io/alabor) on keybase.
  • I have a public key whose fingerprint is A212 B280 96E1 A486 30FD 88F3 9BEB FCA1 04E4 AEA3

To claim this, I am signing this object:

@swissmanu
swissmanu / errorOnlyEsLintFormatter.js
Created January 29, 2016 13:42
An ESLint formatter which display statistics for errors and warnings, but outputs only detailed information about errors.
/**
* An ESLint formatter which shows only errors. Warnings are displayed only in form of an aggregated
* total number.
*
* Example Output: Only Warnings:
*
* >
* > 98 problems (0 errors, 98 warnings)
* >
*
@swissmanu
swissmanu / vpn.sh
Last active January 31, 2019 09:35
A shell script to start/stop Check Point Endpoint VPN/Firewall clients on Mac OS X. No more unreachable machines in your network if no VPN is necessary. Tested with version 80.61
#!/bin/bash
#
# by Manuel Alabor <manuel@alabor.me>
# https://github.com/swissmanu
#
SCRIPT_NAME=`basename $0`
VERSION="0.0.1"
print_help()
@swissmanu
swissmanu / gist:cdd0a5991dc177855544
Created April 27, 2015 11:20
Greasemonkey: Show Pull Requests I am involved in on top in Atlassian Stash
// ==UserScript==
// @name Stash: Order PR's
// @namespace me.alabor
// @include https://mystash/stash/projects/PROJECT/repos/REPOSITORY/pull-requests
// @include https://mystash/stash/projects/PROJECT/repos/REPOSITORY/pull-requests?state=open
// @version 1
// @grant none
// @require http://code.jquery.com/jquery-1.11.2.min.js
// ==/UserScript==
@swissmanu
swissmanu / gist:b261341a03f90a2cd332
Created April 27, 2015 09:01
Greasemonkey: Show Build Status in Pull Request Overview in Atlassian Stash
// ==UserScript==
// @name Stash: PR Overview Build Status
// @namespace me.alabor
// @include https://mystash/projects/PROJECT/repos/REPOSITORY/pull-requests
// @include https://mystash/projects/PROJECT/repos/REPOSITORY/pull-requests?state=open
// @version 1
// @grant none
// @require http://code.jquery.com/jquery-1.11.2.min.js
// ==/UserScript==
@swissmanu
swissmanu / SassMeister-input.scss
Created June 27, 2014 09:46
Generated by SassMeister.com.
// ----
// Sass (v3.3.8)
// Compass (v1.0.0.alpha.19)
// ----
div {
$myColor: red;
color: transparentize($myColor, 0.5);
}