Skip to content

Instantly share code, notes, and snippets.

View laat's full-sized avatar
💤

Sigurd Fosseng laat

💤
View GitHub Profile
@isaacs
isaacs / node-and-npm-in-30-seconds.sh
Last active February 20, 2025 22:23
Use one of these techniques to install node and npm without having to sudo. Discussed in more detail at http://joyeur.com/2010/12/10/installing-node-and-npm/ Note: npm >=0.3 is *safer* when using sudo.
echo 'export PATH=$HOME/local/bin:$PATH' >> ~/.bashrc
. ~/.bashrc
mkdir ~/local
mkdir ~/node-latest-install
cd ~/node-latest-install
curl http://nodejs.org/dist/node-latest.tar.gz | tar xz --strip-components=1
./configure --prefix=~/local
make install # ok, fine, this step probably takes more than 30 seconds...
curl https://www.npmjs.org/install.sh | sh
@liamcurry
liamcurry / gist:2597326
Created May 4, 2012 19:56
Vanilla JS vs jQuery

Moving from jQuery

Events

// jQuery
$(document).ready(function() {
  // code
})
@jayj
jayj / flexbox.less
Last active June 23, 2024 01:14
CSS3 Flexbox - LESS Mixins
// --------------------------------------------------
// Flexbox LESS mixins
// The spec: http://www.w3.org/TR/css3-flexbox
// --------------------------------------------------
// Flexbox display
// flex or inline-flex
.flex-display(@display: flex) {
display: ~"-webkit-@{display}";
display: ~"-ms-@{display}box"; // IE10 uses -ms-flexbox
@aaronwolen
aaronwolen / slides.md
Last active November 11, 2022 23:57
Pandoc template to generate reveal.js slideshows.

% Title % Name % Date

My first slide

List

@sntran
sntran / elixir
Last active December 17, 2015 23:09
Dockerfile for Erlang container for Docker.IORename each of these to `Dockerfile` to build the imagedocker build -t="{imagename}" .docker run -i -t {imagename} /bin/bash
# Elixir on Erlang
#
# VERSION 0.13.2
FROM sntran/kerl
MAINTAINER Son Tran-Nguyen "[email protected]"
RUN apt-get install -y unzip
RUN mkdir -p /opt/erlang/elixir
RUN cd /opt/erlang/elixir && curl -L -O https://github.com/elixir-lang/elixir/releases/download/v0.13.2/Precompiled.zip && unzip Precompiled.zip
@pmeenan
pmeenan / user-timing-rum.js
Last active January 18, 2024 23:46
Support routine for adding W3C user timing events to a site. Includes some basic polyfill support for browsers that don't support user timing or navigation timing (though the start time for non-navigation timing support could be improved with IE < 9 to use IE's custom start event).
// Support routines for automatically reporting user timing for common analytics platforms
// Currently supports Google Analytics, Boomerang and SOASTA mPulse
// In the case of boomerang, you will need to map the event names you want reported
// to timer names (for mPulse these need to be custom0, custom1, etc) using a global variable:
// rumMapping = {'aft': 'custom0'};
(function() {
var wtt = function(n, t, b) {
t = Math.round(t);
if (t >= 0 && t < 3600000) {
// Google Analytics
// --------------------------------------------------
// Flexbox LESS mixins
// The spec: http://www.w3.org/TR/css3-flexbox
// --------------------------------------------------
// Flexbox display
// flex or inline-flex
.flex-display(@display: flex) {
.old-flex-display(@display);
display: ~"-webkit-@{display}";
@ChristinGorman
ChristinGorman / gist:6890462
Last active December 25, 2015 00:49
Attempt at function pointers in java :-)
package no.gorman.stop.it;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import javassist.util.proxy.MethodHandler;
import javassist.util.proxy.ProxyFactory;
/**
* I like using Mockito in tests and wondered if I could create
@lelandbatey
lelandbatey / whiteboardCleaner.md
Last active February 24, 2025 01:16
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

@stuntgoat
stuntgoat / indent_sql.el
Created February 10, 2014 08:55
An indentation heuristic for Emacs' sql-mode
(defun get-previous-indentation ()
"Get the column of the previous indented line"
(interactive)
(save-excursion
(progn
(move-beginning-of-line nil)
(skip-chars-backward "\n \t")
(back-to-indentation))
(current-column)))