Skip to content

Instantly share code, notes, and snippets.

View kounelios13's full-sized avatar

Manos Kounelakis kounelios13

View GitHub Profile
@davidbanham
davidbanham / gist:1186032
Created September 1, 2011 12:02
Dynamically generate a file download in express without touching the filesystem
var express = require('express');
var app = require('express').createServer();
app.listen('3030');
app.get('/', function(req, res) {
res.contentType('text/plain');
res.send('This is the content', { 'Content-Disposition': 'attachment; filename=name.txt' });
});
@makeusabrew
makeusabrew / dialog-hide-all.js
Created November 7, 2011 13:16
bootbox.js - programatically hide all dialogs
bootbox.alert("Hello");
bootbox.confirm("Can you take it?");
bootbox.alert("Boo!");
setTimeout(function() {
// that's enough of that
bootbox.hideAll();
}, 3000);
@kitek
kitek / gist:1579117
Created January 8, 2012 17:50
NodeJS create md5 hash from string
var data = "do shash'owania";
var crypto = require('crypto');
crypto.createHash('md5').update(data).digest("hex");
@rachelbaker
rachelbaker / object-storage.js
Created August 6, 2013 02:00
Extending Local Storage to save and get Objects
/**
* Extending the Local Storage Object to allow saving of objects.
*
* @param int|string key object key
* @param int|string value object value
* @return bool true|false
*/
Storage.prototype.setObject = function(key, value) {
this.setItem(key, JSON.stringify(value));
};
# Node-WebKit CheatSheet
# Download: https://github.com/rogerwang/node-webkit#downloads
# Old Versions: https://github.com/rogerwang/node-webkit/wiki/Downloads-of-old-versions
# Wiki: https://github.com/rogerwang/node-webkit/wiki
# How: https://github.com/rogerwang/node-webkit/wiki/How-node.js-is-integrated-with-chromium
# 1. Run your application.
# https://github.com/rogerwang/node-webkit/wiki/How-to-run-apps
@cuth
cuth / debug-scroll.md
Last active July 20, 2024 17:22
Find the elements that are causing a horizontal scroll. Based on http://css-tricks.com/findingfixing-unintended-body-overflow/

Debug Horizontal Scroll

(function (d) {
    var w = d.documentElement.offsetWidth,
        t = d.createTreeWalker(d.body, NodeFilter.SHOW_ELEMENT),
        b;
    while (t.nextNode()) {
        b = t.currentNode.getBoundingClientRect();
 if (b.right > w || b.left < 0) {
@kyle-ilantzis
kyle-ilantzis / open-w-atom.reg
Last active June 1, 2021 17:20
Adds 'Open in Atom' to context menu in Windows Explorer.
Windows Registry Editor Version 5.00
;
; Adds 'Open in Atom' to context menu (when you right click) in Windows Explorer.
;
; Based on https://github.com/Zren/atom-windows-context-menu. It didn't work
; https://github.com/Zren/atom-windows-context-menu/issues/1.
;
; Save this file to disk with a .reg extension. Replace C:\\Atom\\atom.exe with
; the path to the atom executable on your machine.
@novadev94
novadev94 / memoization.py
Last active October 23, 2016 15:22
Dynamic Programming Memoization in Python
import functools
def memoization(mem_dict):
""" This is a version for modules' functions.
:Parameter - `mem_dict`
A global variable used to store the calculation result
:Usage
fibo_dict = {}
@memoization(fibo_dict)
@J2TEAM
J2TEAM / sublime-text-scopes.md
Last active January 17, 2024 22:44 — forked from iambibhas/scopes.txt
Sublime Text 2/3: Snippet scopes

Here is a list of scopes to use in Sublime Text 2/3 snippets -

ActionScript: source.actionscript.2
AppleScript: source.applescript
ASP: source.asp
Batch FIle: source.dosbatch
C#: source.cs
C++: source.c++
Clojure: source.clojure
@pirate
pirate / parseURLParameters.js
Last active December 15, 2023 07:17
Parse URL query parameters in ES6
function getUrlParams(search) {
const hashes = search.slice(search.indexOf('?') + 1).split('&')
const params = {}
hashes.map(hash => {
const [key, val] = hash.split('=')
params[key] = decodeURIComponent(val)
})
return params
}