Skip to content

Instantly share code, notes, and snippets.

@tomviner
tomviner / gist:4285213
Created December 14, 2012 12:41 — forked from seb-thomas/gist:4285197
with if?
$.getJSON('media/js/markers.json', function(data){
$.each(data.markers, function(i, marker){
if (...) {
map.addMarker({
id: i,
tags: marker.tag,
lat: marker.latitude,
lng: marker.longitude,
infoWindow: {
content: '<h2>' + marker.name + '</h2><p>' + marker.address + '</p>'
@tomviner
tomviner / updated?
Last active December 13, 2015 21:38 — forked from seb-thomas/updated?
with console.logs
var YOUR_API_KEY = ''
var dateUpdated = "";
function changeTitle() {
var favi = jQuery('[rel="shortcut icon"]');
var titleDate = jQuery('p.author a').last().attr('title');
var reDate = /(\d+)\/(\d+)\/(\d+)/;
//Swap year and day, convert to Date obj
titleDate = (titleDate).replace(reDate, "$3/$2/$1");
if(typeof jQuery !== 'undefined'){
jQuery(function($) {
var dateUpdated = "";
var reDate = /(\d+)\/(\d+)\/(\d+)/;
var reIssues = /issues\/\d+/;
var titleDate = $('p.author a').last().attr('title');
var style= 'position: fixed;bottom: 0px;margin-bottom: 0px;width: 100%;padding: 12px 0px 13px 30px;background-position-y: 12px;';
var warning = '<div class="flash warning" style="'+style+'">This issue has been updated since you last saw it. <a href="javascript:location.reload(true);">Refresh now</a></div>';
@tomviner
tomviner / maze.py
Last active December 17, 2015 02:38 — forked from teh/maze.py
import sys
import random
import turtle
W = H = 10
def outer_walls(w, h):
# Add some walls to confine the maze
# And yield them in order of a perimeter walk
@tomviner
tomviner / queens.py
Last active September 20, 2016 20:26 — forked from teh/sudoku.py
8 Queens problem with a SAT solver
import pycosat
import numpy
import itertools
blank_idx = 0
queen_idx = 1
def get_cnf():
# * add one because 0 is reserved in picosat
# * object type because pycosat expects 'int's
from itertools import count, takewhile
from math import sqrt
import time
try:
# Python 2 compat
from itertools import ifilter as filter
except ImportError:
pass
@tomviner
tomviner / README.md
Last active November 5, 2023 14:27 — forked from oryband/prepare-commit-msg
Appends branch name to git commit message. `cp prepare-commit-msg .git/hooks/prepare-commit-msg`

Clone

git clone [email protected]:faf373e5c05a8cb4bc49c048504dbea6.git git-hook-prepare-commit-msg