Skip to content

Instantly share code, notes, and snippets.

View vindia's full-sized avatar

Vincent Oord vindia

View GitHub Profile
@vindia
vindia / tabs.haml
Created June 6, 2013 13:11
Minimalist (Github-like) tabs using Haml and Sass
%ul.tabs
%li
%a.active{ href: '#'} Tab 1
%li
%a{ href: '#'} Tab 2
%li
%a{ href: '#'} Tab 3
%li
%a{ href: '#'} Tab 4
%li
@vindia
vindia / bookmarklet.html
Created February 11, 2013 15:30
Bookmarklet to reveal a phone number that's hidden on a site, without clicking the link that will trigger some event. This is used for example on iens.nl, a Dutch restaurant reviewing website.
javascript:(function()%7Bdocument.getElementById(%27phonenumber%27).className%3D%27%27%3B%7D)()%3B
@vindia
vindia / git_commit_leaderbord.rb
Last active October 20, 2017 13:34
Simple Ruby + Git script to get a commit leaderboard for your repository.
def leaderboard(project)
leaderboard = []
committers = `cd ~/#{project}; git checkout master; git shortlog -nse --no-merges --since={last.month}`
committers.split("\n").each do |committer|
c = committer.split("\t")
leaderboard.push name: c.last.split('<').first.strip, values: [c.first.to_i]
end
leaderboard
@vindia
vindia / sitemapper.rb
Created November 20, 2012 13:43
Simple script for retrieving URLs out of generated sitemaps as used by Google Analytics and the like.
require 'open-uri'
require 'nokogiri'
def add_urls_to_buffer!
@xml.css('sitemap loc').each{ |node| @buffer << node.text }
end
def save_urls_to_file!
@xml.css('url loc').each do |url|
puts "Saving #{url.text}"
@vindia
vindia / ocdify.rb
Created September 29, 2012 11:41
OCDify (set all letters in a word in the correct order)
# Order all letters in a word in a string
#
# Examples:
#
# ocdify('What is the point of this')
# # => 'ahtw is eht inopt fo hist'
#
# Returns the ordered String
def ocdify(string)
a = []
@vindia
vindia / droplet.css
Created August 13, 2012 12:13
CSS 3 Water Droplet
body { padding: 4em; }
#droplet {
background-color: lightblue;
width: 150px;
height: 150px;
-webkit-border-top-left-radius: 0;
-webkit-border-top-right-radius: 75px;
-webkit-border-bottom-right-radius: 75px;
-webkit-border-bottom-left-radius: 75px;
-webkit-transform:rotate(45deg);
@vindia
vindia / pre-commit.rb
Last active October 7, 2015 22:38 — forked from jvatic/pre-commit.rb
Git pre-commit hook to block committing Spec files with :focus => true on test blocks and .orig files from merge conflicts
#!/usr/bin/env ruby
orig_hits = []
spec_hits = []
# In Mountion Lion Apple uses BSD grep with REG_ENHANCED enabled,
# so all regular regex special chars like ?, | and + need to be
# escaped...
def grep_focus
if `grep --v`.match /BSD/
@vindia
vindia / social-sharing-links.html
Last active January 19, 2021 02:55
Cookieless social media sharing
@vindia
vindia / assigned_to_pullrequest.rb
Created May 11, 2012 16:40
Fetch username of person assigned to GitHub pull request
require 'json'
require 'open-uri'
user = 'GITHUB_USERNAME'
pass = 'GITHUB_PASSWORD'
repo = 'user/repo'
pulls = JSON.parse(open("https://api.github.com/repos/#{repo}/pulls", :http_basic_authentication => [user, pass]).read)
pulls.each do |pull|
@vindia
vindia / carbon.sh
Created May 3, 2012 08:20
Startup script for Carbon
#!/bin/bash
### BEGIN INIT INFO
# Provides: carbon
# Required-Start: $syslog
# Required-Stop: $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Runs carbon, a data aggregator
# Description: Runs the data aggregator needed for Graphite