Skip to content

Instantly share code, notes, and snippets.

View nok's full-sized avatar

Darius Morawiec nok

View GitHub Profile
@gleuch
gleuch / gist:2475825
Created April 24, 2012 02:58
Javascript documentfragment to string (w/ text selection)
// selection range
var range = window.getSelection().getRangeAt(0);
// plain text of selected range (if you want it w/o html)
var text = window.getSelection();
// document fragment with html for selection
var fragment = range.cloneContents();
// make new element, insert document fragment, then get innerHTML!
@stevenh512
stevenh512 / gitconfig-git
Created June 11, 2012 10:51
URL rewriting in .gitconfig
# Use git and git+ssh instead of https
[url "git://github.com/"]
insteadOf = https://github.com/
[url "git@github.com:"]
pushInsteadOf = "git://github.com/"
[url "git@github.com:"]
pushInsteadOf = "https://github.com/"
"""
=====================================================
Distance computations for masked arrays (:mod:`scipy.spatial.mdistance`)
=====================================================
.. sectionauthor:: Damian Eads, Jason Merkin
Function Reference
------------------
@m3nd3s
m3nd3s / NERDTree.mkd
Last active November 23, 2023 13:45
My Vim Cheat Sheet

NERDTree

o.......Open files, directories and bookmarks....................|NERDTree-o|
go......Open selected file, but leave cursor in the NERDTree.....|NERDTree-go|
t.......Open selected node/bookmark in a new tab.................|NERDTree-t|
T.......Same as 't' but keep the focus on the current tab........|NERDTree-T|
i.......Open selected file in a split window.....................|NERDTree-i|
gi......Same as i, but leave the cursor on the NERDTree..........|NERDTree-gi|
s.......Open selected file in a new vsplit.......................|NERDTree-s|
gs......Same as s, but leave the cursor on the NERDTree..........|NERDTree-gs|

O.......Recursively open the selected directory..................|NERDTree-O|

@ebidel
ebidel / Web Components Resources.md
Last active February 27, 2023 22:04
List of resources related to Web Components
@fabeat
fabeat / scale.py
Created September 19, 2013 10:13 — forked from enagorny/scale.py
from PIL import Image
def scale(image, max_size, method=Image.ANTIALIAS):
"""
resize 'image' to 'max_size' keeping the aspect ratio
and place it in center of white 'max_size' image
"""
im_aspect = float(image.size[0])/float(image.size[1])
out_aspect = float(max_size[0])/float(max_size[1])
if im_aspect >= out_aspect:
@dr-dimitru
dr-dimitru / .htaccess
Last active April 2, 2018 22:05
.htaccess file for Laravel 4 and Laravel 3 | For root/ folder
# ----------------------------------------------------------------------
# ROOT/ folder .htaccess
# ----------------------------------------------------------------------
# Laravel Note:
# Note: Laravel is designed to protect your application code,
# and local storage by placing only files that are necessarily
# public in the public folder. It is recommended that you either
# set the public folder as your site's documentRoot (also known as a web root)
# or to place the contents of public into your site's root directory
# and place all of Laravel's other files outside the web root.
@mathisonian
mathisonian / emoji-support.js
Created December 10, 2013 03:24
Detect emoji support
/**
* Determine if this browser supports emoji.
*
* Modified from https://gist.github.com/mwunsch/4710561
* and probobly originally github's javascript source
*/
function doesSupportEmoji() {
var context, smiley;
if (!document.createElement('canvas').getContext) return;
context = document.createElement('canvas').getContext('2d');
@isellsoap
isellsoap / gist:8299726
Last active February 13, 2023 23:11
A Sass function for converting px to em values. Works with mixed px and em values and with nested em structures.
$base-font-size: 16px;
/**
* Strips the unit from a given number-unit-combination and returns the number.
* @link: http://stackoverflow.com/a/12335841/1779999
* @usage: parse-int(10px) => 10
*/
@function parse-int($number) {
@return $number / ($number * 0 + 1);
@lelandbatey
lelandbatey / whiteboardCleaner.md
Last active April 25, 2024 02:01
Whiteboard Picture Cleaner - Shell one-liner/script to clean up and beautify photos of whiteboards!

Description

This simple script will take a picture of a whiteboard and use parts of the ImageMagick library with sane defaults to clean it up tremendously.

The script is here:

#!/bin/bash
convert "$1" -morphology Convolve DoG:15,100,0 -negate -normalize -blur 0x1 -channel RBG -level 60%,91%,0.1 "$2"

Results