Skip to content

Instantly share code, notes, and snippets.

#!/bin/sh
# This has to be run from develop
git checkout develop
# Update our list of remotes
git fetch
git remote prune origin
# Remove local fully merged branches
%%%-------------------------------------------------------------------
%%% File : quad_tree.erl
%%% @author Jamie Burrell
%%% @doc Erlang implementation of a quadratic tree.
%%% @end
%%% @since 2009-02-10
%%% @end
%%%-------------------------------------------------------------------
-module(quad_tree).
@lucaspiller
lucaspiller / prepare-commit-msg.sh
Created October 8, 2015 11:34
Automatic @vjt style Git commit messages
#!/bin/sh
# Install this in your Git repo in .git/hooks/prepare-commit-msg. Git doesn't
# support global hooks, but you can work around it using templates, see:
#
# https://github.com/mroth/lolcommits/wiki/Enabling-Lolcommits-for-all-your-Git-Repositories.
ORIGINAL_COMMIT_MSG=$(cat "$1")
# from http://www.emoji-cheat-sheet.com/
sudo apt-get install mongodb ◼ version:2.1.6
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages were automatically installed and are no longer required:
libabw-0.0-0 libatkmm-1.6-1 libboost-filesystem1.55.0 libboost-program-options1.55.0 libboost-regex1.55.0 libcairomm-1.0-1 libdrm-dev libe-book-0.0-0 libegl1-mesa-dev libetonyek-0.0-0 libfreehand-0.0-0 libgl1-mesa-dev libglibmm-2.4-1c2a libgtkmm-2.4-1c2a libmwaw-0.2-2 libpangomm-1.4-1 libwayland-dev libx11-xcb-dev libxcb-dri2-0-dev libxcb-dri3-dev libxcb-glx0-dev libxcb-present-dev libxcb-randr0 libxcb-randr0-dev libxcb-shape0-dev libxcb-sync-dev libxcb-xfixes0-dev libxshmfence-dev libxxf86vm-dev
mesa-common-dev x11proto-dri2-dev x11proto-gl-dev x11proto-xf86vidmode-dev
Use 'apt-get autoremove' to remove them.
The following extra packages will be installed:
binutils binutils-dev cpp cpp-5 dbus g++ g++-5 gcc gcc-5 gcc-5-base libabw-0.1-1 libapparmor1 libasan2 libatomic1 libboost-date-time1.58.0 li
@lucaspiller
lucaspiller / active_job.rb
Created May 11, 2015 12:41
ActiveJob + Cucumber
# features/support/active_job.rb
# Specify the inline adapter so jobs run straight away
Rails.application.config.active_job.queue_adapter = :inline
@lucaspiller
lucaspiller / dates.rb
Last active August 29, 2015 14:04
HMRC Residency Check
require 'active_support/core_ext'
in_out = :out
out_days = 0
in_days = 0
transit_days = 0
last = "2013-05-06".to_date
@lucaspiller
lucaspiller / honeypot.c
Created July 3, 2014 17:23
DMCA Honeypot
/*
* This file is not Copyright (C) QUALCOMM Austria Research Center GmbH.
* It is not Copyright (C) Sony Computer Entertainment America LLC ("SCEA").
* It is also not Copyright (C) of Apple Inc. (“Apple”).
* Lastly it is not Copyright (C) Epic Games, Inc.
*/
#include <stdio.h>
int main() {
@lucaspiller
lucaspiller / gist:c544024738bca2be598f
Created May 20, 2014 14:11
wysihtml5: Tidy HTML pasted from Word
var tidyHtml = function() {
var html = this.getValue();
// remove empty paragraphs
html = html.replace(/<p>(&nbsp;|\s+)?<\/p>/g, "");
html = html.replace(/<p><b>(&nbsp;|\s+)?<\/b><\/p>/g, "");
// remove newlines between words
html = html.replace(/([^>])\n([^<])/g, "$1 $2");
@lucaspiller
lucaspiller / rss.xml
Created February 26, 2014 13:56
Octopress, export all posts as RSS
---
layout: nil
---
<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:dc="http://purl.org/dc/elements/1.1/" version="2.0">
<channel>
<atom:link rel="hub" href="http://pubsubhubbub.appspot.com" xmlns:atom="http://www.w3.org/2005/Atom"/>
<title>{{ site.title | xml_escape }}</title>
<generator>Octopress</generator>
<link>{{ site.url }}</link>
@lucaspiller
lucaspiller / auto-save-remote-images.php
Created February 19, 2014 15:19
Auto Save Remote Images WP Plugin
<?php
/*
Plugin Name: Auto Save Remote Image
Plugin URI: http://www.devsaab.com/wordpress/
Description: This plugin automatically downloads the first remote image from a post and sets it as the featured image.
Version: 1.3
Author: Prebhdev Singh
Disclaimer: No warranty or guarantee of any kind! Use this in your own risk.
*/
add_action('publish_post', 'fetch_images');