Skip to content

Instantly share code, notes, and snippets.

View Colorfulstan's full-sized avatar

Jonas Krispin Colorfulstan

View GitHub Profile
@Colorfulstan
Colorfulstan / gist:312d5f77187570245c9c654d39f9bdc6
Created January 22, 2019 10:06 — forked from AndrewRayCode/gist:825583
recursive read directory in node.js returning flattened list of files and directories
function readDir(start, callback) {
// Use lstat to resolve symlink if we are passed a symlink
fs.lstat(start, function(err, stat) {
if(err) {
return callback(err);
}
var found = {dirs: [], files: []},
total = 0,
processed = 0;
function isDir(abspath) {
@Colorfulstan
Colorfulstan / iptables.sh
Created October 22, 2018 10:51 — forked from danibram/iptables.sh
Redirect 443,80 to 8443,8080 on ubuntu with persistence
sudo iptables -A PREROUTING -t nat -i eth0 -p tcp --dport 80 -j REDIRECT --to-port 8080
sudo iptables -A PREROUTING -t nat -i eth0 -p tcp --dport 443 -j REDIRECT --to-port 8443
sudo sh -c "iptables-save > /etc/iptables.rules"
sudo apt-get install iptables-persistent
@Colorfulstan
Colorfulstan / js-get-fn-name.js
Created May 4, 2016 13:47 — forked from dfkaye/js-get-fn-name.js
get a javascript function name
function getFnName(fn) {
var f = typeof fn == 'function';
var s = f && ((fn.name && ['', fn.name]) || fn.toString().match(/function ([^\(]+)/));
return (!f && 'not a function') || (s && s[1] || 'anonymous');
}
console.log(getFnName(String)); // 'String'
console.log(getFnName(function test(){})); // 'test'
console.log(getFnName(function (){})); // 'anonymous'
@Colorfulstan
Colorfulstan / overwolf.d.ts
Last active October 9, 2015 16:53 — forked from punmechanic/overwolf.d.ts
Overwolf API definition file (not completely up to date)
interface OverwolfStatic {
utils: OverwolfUtils;
profile: OverwolfProfile;
extensions: OverwolfExtensions;
games: OverwolfGames;
media: OverwolfMedia;
settings: OverwolfSettings;
streaming: OverwolfStreaming;
windows: OverwolfWindows;
@Colorfulstan
Colorfulstan / css_resources.md
Last active September 6, 2015 06:06 — forked from jookyboi/css_resources.md
CSS libraries and guides to bring some order to the chaos.

scripts

  • reset.css resetting settings in css that might be unwanted defaults
  • normalize.css more consistent rendering across various browsers

Libraries

  • frontend Frameworks comparison
  • 960 Grid System - An effort to streamline web development workflow by providing commonly used dimensions, based on a width of 960 pixels. There are two variants: 12 and 16 columns, which can be used separately or in tandem.
  • Compass - Open source CSS Authoring Framework.
  • Bootstrap - Sleek, intuitive, and powerful mobile first front-end framework for faster and easier web development.
  • Zurb Foundation - Framework for writing responsive web sites.
@Colorfulstan
Colorfulstan / javascript_resources.md
Last active February 3, 2016 12:37 — forked from jookyboi/javascript_resources.md
Here are a set of libraries, plugins and guides which may be useful to your Javascript coding.

Libraries

  • AngularJS - Conventions based MVC framework for HTML5 apps.
  • Underscore - Underscore is a utility-belt library for JavaScript that provides a lot of the functional programming support that you would expect in Prototype.js (or Ruby), but without extending any of the built-in JavaScript objects.
  • moment.js - Time formatting and manipulation
  • jQuery - The de-facto library for the modern age. It makes things like HTML document traversal and manipulation, event handling, animation, and Ajax much simpler with an easy-to-use API that works across a multitude of browsers.
  • Backbone - Backbone.js gives structure to web applications by providing models with key-value binding and custom events, collections with a rich API of enumerable functions, views with declarative event handling, and connects it all to your existing API over a RESTful JSON interface.
  • [lawnchair](http://br
@Colorfulstan
Colorfulstan / gistbox_keyboard_shortcuts.md
Last active August 29, 2015 14:24
Here are some things you can do with Gists in GistBox.

keyboard shortcuts within GistBox

  • Up/Down - Previous/Next Gist
  • Ctrl+e - Edit a selected Gist
  • Ctrl+s - Save Gist
  • ESC - Cancel editing snippet
  • CTRL+F - search