Skip to content

Instantly share code, notes, and snippets.

@jlong
jlong / uri.js
Created April 20, 2012 13:29
URI Parsing with Javascript
var parser = document.createElement('a');
parser.href = "http://example.com:3000/pathname/?search=test#hash";
parser.protocol; // => "http:"
parser.hostname; // => "example.com"
parser.port; // => "3000"
parser.pathname; // => "/pathname/"
parser.search; // => "?search=test"
parser.hash; // => "#hash"
parser.host; // => "example.com:3000"
@gmccreight
gmccreight / master.vim
Last active September 23, 2023 08:41
A script that gives you a playground for mastering vim
" copy all this into a vim buffer, save it, then...
" source the file by typing :so %
" Now the vim buffer acts like a specialized application for mastering vim
" There are two queues, Study and Known. Depending how confident you feel
" about the item you are currently learning, you can move it down several
" positions, all the way to the end of the Study queue, or to the Known
" queue.
" type ,, (that's comma comma)
@mranney
mranney / emoji_sad.txt
Created January 30, 2012 23:05
Why we can't process Emoji anymore
From: Chris DeSalvo <chris.desalvo@voxer.com>
Subject: Why we can't process Emoji anymore
Date: Thu, 12 Jan 2012 18:49:20 -0800
Message-Id: <AE459007-DF2E-4E41-B7A4-FA5C2A83025F@voxer.com>
--Apple-Mail=_6DEAA046-886A-4A03-8508-6FD077D18F8B
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain;
charset=utf-8
@jjcomer
jjcomer / ants.clj
Created December 18, 2011 18:22
Ant Simulation -- From Clojure Concurrency Presentation
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ant sim ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Copyright (c) Rich Hickey. All rights reserved.
; The use and distribution terms for this software are covered by the
; Common Public License 1.0 (http://opensource.org/licenses/cpl.php)
; which can be found in the file CPL.TXT at the root of this distribution.
; By using this software in any fashion, you are agreeing to be bound by
; the terms of this license.
; You must not remove this notice, or any other, from this software.
;As shown in the presentation: http://blip.tv/clojure/clojure-concurrency-819147
@balupton
balupton / LINUX.md
Last active May 27, 2022 10:22
New Machine Start Kit

Linux

Setup

# If inside vmware install vmware tools (these are just as good as the commercial ones)
sudo apt-get install open-vm-tools open-vm-tools-desktop

# Install git
sudo apt-get install git
@clohr
clohr / sets.js
Created February 26, 2017 19:09
ES6 Sets: Intersection, Difference, and Union
const a = new Set([1, 2, 3, 4, 4, 4])
const b = new Set([3, 4, 5, 6])
const intersect = (set1, set2) => [...set1].filter(num => set2.has(num))
const differ = (set1, set2) => [...set1].filter(num => !set2.has(num))
const joinSet = (set1, set2) => [...set1, ...set2]
const myIntersectedSet = new Set(intersect(a, b))
console.log('myIntersectedSet', myIntersectedSet)
/* TinyWM is written by Nick Welch <mack@incise.org>, 2005.
* TinyWM-XCB is rewritten by Ping-Hsun Chen <penkia@gmail.com>, 2010
*
* This software is in the public domain
* and is provided AS IS, with NO WARRANTY. */
#include <xcb/xcb.h>
int main (int argc, char **argv)
{
@cmlsharp
cmlsharp / !!
Last active November 26, 2019 11:57
Repeat most recent command in fish
# Add this to your ~/.config/fish/config.fish
# Syntax:
# To just rerun your last command, simply type '!!'
# '!! sudo' will prepend sudo to your most recent command
# Running !! with anything other than sudo will append the argument to your most recent command
# To add another command to prepend list remove the # on line 10 and put the command in the quotes. Repeat as needed
function !!;
set prevcmd (history | head -n 1)
if test "$argv"
if test "$argv" = "sudo" #; or "any other command you want to prepend"
@dcat
dcat / tile.xbm
Created October 30, 2014 15:02
tile.xbm
#define tile_width 56
#define tile_height 32
static unsigned char tile_bits[] = {
0x01, 0x40, 0x20, 0x10, 0x08, 0x04, 0x00, 0x06, 0x40, 0x20, 0x10, 0x08,
0x04, 0xc0, 0x18, 0x40, 0x20, 0x10, 0x08, 0x04, 0x30, 0x60, 0x40, 0x20,
0x10, 0x08, 0x04, 0x0c, 0x80, 0x40, 0x20, 0x10, 0x08, 0x04, 0x02, 0xe0,
0x43, 0x18, 0x10, 0x30, 0x84, 0x0f, 0x98, 0x4c, 0x06, 0x10, 0xc0, 0x64,
0x32, 0x86, 0xf0, 0x01, 0x10, 0x00, 0x1f, 0xc2, 0x81, 0x70, 0x00, 0x10,
0x00, 0x0c, 0x02, 0x81, 0x08, 0x00, 0x6c, 0x00, 0x18, 0x02, 0x81, 0x04,
0x00, 0x83, 0x01, 0x60, 0x02, 0x81, 0x03, 0xc0, 0x00, 0x06, 0x80, 0x03,
@chubas
chubas / wordblender.md
Last active February 27, 2019 19:06
Word Blender

GDLJS Monthly Challenge #1 - Word Blender

This is an adaptation for the RubyQuiz #108 Word Blender, lots of spoilers there so best to look after!

Word Blender

The task for this month is to build a game based on the popular game TextTwist (and many other variations there are). It can be built as sophisticaded as you want, ranging from a command line game to a full featured GUI game if you want.

Rules