Skip to content

Instantly share code, notes, and snippets.

View iki's full-sized avatar

Jan Killian iki

View GitHub Profile
@iki
iki / gulpfile.js
Last active January 18, 2019 16:38
generating API documentation from RAML specification using raml2html in gulp
'use strict';
var gulp = require('gulp');
var path = require('path');
var CWD = path.resolve('.');
var API_SPEC = path.resolve(CWD, '../api/api.raml');
var API_DEST = path.resolve(CWD, '../server/static/docs/api');
var API_HTML = 'index.html';
@iki
iki / README.md
Last active December 12, 2021 08:50 — forked from othiym23/npm-upgrade-bleeding.sh
Update global top level npm packages

Update global top level npm packages

Problem

npm update -g updates all global packages and their dependencies, see npm/npm#6247.

Solution

  1. Either use the shell script or windows batch here instead.
#!/usr/bin/env python
from __future__ import print_function
import re
import os
import sys
import glob
LF = '\n'
fs = require 'fs'
log = console.log
dump = (obj) -> JSON.stringify obj, null, 2
keys = Object.keys
src = process.argv[2] or 'package.json'
log src
pkg = JSON.parse fs.readFileSync src
log 'JSON: ' + dump pkg
# Edit this file as you like and merge with $HOME/.gitconfig (global) or .git/config (given repo only)
#
# See https://help.github.com/articles/set-up-git
#
# See http://git-scm.com/docs/git-config
# or http://www.kernel.org/pub/software/scm/git/docs/git-config.html
#
# See http://git-scm.com/book/en/Customizing-Git-Git-Configuration
# or http://progit.org/book/ch7-1.html
#
@iki
iki / app.js
Created September 17, 2014 14:37
snippets for dynamic color scheme
if (settings.mainColor) {
_.each(document.styleSheets, function(styleSheet) {
if (styleSheet.title === 'mainColor') {
_.each(styleSheet.cssRules || styleSheet.rules, function(rule) {
if (rule.type === 1 && rule.cssText && rule.style) {
if (rule.cssText.indexOf('BgColor') !== -1) {
console.log('style: background color ' + settings.mainColor + ' @ ' + rule.cssText, {rule: rule});
rule.style.backgroundColor = settings.mainColor;
}
if (rule.cssText.indexOf('FontColor') !== -1) {
@iki
iki / ubuntu-14.04-desktop-amd64.sh
Last active August 29, 2015 13:59
shell script to download [kxl]ubuntu release iso ... just rename the script to requested edition-release-type-platform
#!/bin/sh
name="${0##*/}"
name="${name%.sh}"
edition="${name%%-*}"
version="${name#*-}"
version="${version%%-*}"
# use main ubuntu cdimage server
if [ "$edition" = 'ubuntu' ]; then
@iki
iki / vm-cleanup
Last active August 29, 2015 13:58
Cleanup VM for exporting to appliance
#!/bin/bash
#|Usage: <command> [OPTIONS]
#|
#|Clean development VM for exporting to appliance:
#|
#| - update system: apt-get update and upgrade
#| - install zerofree package
#| - remove user ssh keys
#| - stop foreman and django
#| - stop mongodb, compact database, purge journal
@iki
iki / logging.js
Last active August 29, 2015 13:57
Enable logs from your unit tests using logging.on|off() methods
/*Enable logs from your unit tests using logging.on|off() methods.
Provides stringifier to stripped JSON for safe logging of objects
with cyclical references, DOM elements, angular scopes, or window.
By default, logging.on/off() works with window.console,
or with $log service if angular is detected.
By default, logging class attaches to jasmine.logging,
or mocha.logging, or window.logging.