Skip to content

Instantly share code, notes, and snippets.

//
// Regular Expression for URL validation
//
// Author: Diego Perini
// Created: 2010/12/05
// Updated: 2018/09/12
// License: MIT
//
// Copyright (c) 2010-2018 Diego Perini (http://www.iport.it)
//
@jed
jed / LICENSE.txt
Created May 20, 2011 13:27 — forked from 140bytes/LICENSE.txt
generate random UUIDs
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2011 Jed Schmidt <http://jed.is>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
@soney
soney / get_rounded_rectangular_shape.js
Created July 30, 2011 22:21
Gets a rounded shape in the form of an SVG Path
var get_rounded_rectangular_shape = function(points, r) {
var sb;
if(r === 0) {
sb = new Array(3*(points.length+1));
//Set up a move to and a line to the initial point
sb[0] = "M";
sb[3*points.length] = "L";
sb[1] = sb[3*points.length + 1] = points[0][0];
@LeverOne
LeverOne / LICENSE.txt
Created October 24, 2011 04:17 — forked from jed/LICENSE.txt
generate random v4 UUIDs (107 bytes)
DO WTF YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2011 Alexey Silin <[email protected]>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WTF YOU WANT TO PUBLIC LICENSE
@llkats
llkats / cheatsheet.md
Last active April 18, 2025 05:44
git cheatsheet

git flow feature start <branchname>
starts a new branch

git commit -am "commit message"
make commits as usual

git pull
from master branch, pull in latest changes from the repo (repeat often)

git pull origin <branchname>

@pixelhandler
pixelhandler / pre-push.sh
Last active July 2, 2024 11:27
Git pre-push hook to prevent force pushing master branch
#!/bin/sh
# Called by "git push" after it has checked the remote status,
# but before anything has been pushed.
#
# If this script exits with a non-zero status nothing will be pushed.
#
# Steps to install, from the root directory of your repo...
# 1. Copy the file into your repo at `.git/hooks/pre-push`
# 2. Set executable permissions, run `chmod +x .git/hooks/pre-push`
@stealthonion
stealthonion / _button.sass
Created June 17, 2013 00:25
SASS: Dynamic button mixin
@mixin button($padding: 5px 5px 5px 10px, $font-size: 1.1em, $width: auto, $bg-color-start: #479dcf, $bg-color-end: #2f6db7, $text-color: #FFF, $border-radius: 3px)
color: $text-color
background: $bg-color-start
$border-base: adjust-hue(darken($bg-color-start, 15%), 5%)
@include filter-gradient($bg-color-start, $bg-color-end, vertical) // IE6-8
// IE9 SVG, needs conditional override of 'filter' to 'none'
$experimental-support-for-svg: true
@include background-image(linear-gradient(top, $bg-color-start 0%,$bg-color-end 99%))
border-top: 1px solid $border-base
border-right: 1px solid adjust-hue(saturate(darken($border-base, 7%), 12%), 5%)
@mudge
mudge / eventemitter.js
Last active December 4, 2024 08:35
A very simple EventEmitter in pure JavaScript (suitable for both node.js and browsers).
/* Polyfill indexOf. */
var indexOf;
if (typeof Array.prototype.indexOf === 'function') {
indexOf = function (haystack, needle) {
return haystack.indexOf(needle);
};
} else {
indexOf = function (haystack, needle) {
var i = 0, length = haystack.length, idx = -1, found = false;
@kerimdzhanov
kerimdzhanov / random.js
Last active February 26, 2025 22:12
JavaScript: get a random number from a specific range
/**
* Get a random floating point number between `min` and `max`.
*
* @param {number} min - min number
* @param {number} max - max number
* @return {number} a random floating point number
*/
function getRandomFloat(min, max) {
return Math.random() * (max - min) + min;
}
@lovesh
lovesh / mysql_wrapper.py
Created December 8, 2013 18:39
A MySQLdb wrapper class
import MySQLdb
import MySQLdb.cursors
from config import config
class Cursor(object):
def __init__(self, mysql_cursor):
self.cursor = mysql_cursor
def __iter__(self):