Skip to content

Instantly share code, notes, and snippets.

View priithaamer's full-sized avatar

Priit Haamer priithaamer

View GitHub Profile
@priithaamer
priithaamer / spinner.html
Created February 5, 2014 14:18
Super simple CSS spinner generator using SCSS. Requires bourbon.io
<div class="spinner">
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
var play = function() {
var boxes = $('#box span');
var colors = boxes.map(function(idx, item) {
return $(item).css('background-color');
});
var color1 = {color: $.unique(colors)[0], count: 0};
var color2 = {color: $.unique(colors)[1], count: 0};
boxes.each(function(idx, item) {
@priithaamer
priithaamer / gist:456958
Created June 29, 2010 08:08
Capistrano tasks to show git diff and log between local and remote environments
namespace :git do
desc 'Shows a Git diff between the current version on server and latest on HEAD'
task :diff_pending do
local_sha = `git rev-parse --verify HEAD`
remote_sha = capture("cd #{current_path}; git rev-parse --verify HEAD")
puts `git diff #{remote_sha.strip} #{local_sha.strip}`
end
desc 'Shows a Git log between the current version on server and latest on HEAD'
task :log_pending do
@priithaamer
priithaamer / phone
Created August 19, 2010 07:45
Command line utility to send Prowl notifications to phone
#!/usr/bin/env ruby
require 'rubygems'
require 'yaml'
require 'prowl'
require 'readline'
config_file = File.join(ENV['HOME'], '.prowl')
if File.exist?(config_file)
@priithaamer
priithaamer / post-update
Created September 23, 2010 08:56
Git post-receive file to update contents in another directory on the same server.
#!/bin/sh
#
# An example hook script to prepare a packed repository for use over
# dumb transports.
#
# To enable this hook, rename this file to "post-update".
WORKDIR="/some/git/repo/workdir"
export GIT_DIR=$WORKDIR/.git
pushd $WORKDIR > /dev/null
@priithaamer
priithaamer / showoff-style.css
Created May 28, 2011 09:59
My showoff style
body {
font-family: HelveticaNeue;
font-weight: bold;
}
h1, h2, h3, h4, h5, h6 {
font-weight: bold;
}
@priithaamer
priithaamer / useragent.js
Created July 15, 2011 21:07 — forked from terkel/jquery.ua.js
Node.js User-Agent parser
// Based on fantastic jQuery useragent parser plugin https://gist.github.com/373298
function parse(uaStr) {
var agent = {
platform: {},
browser: {},
engine: {}
};
var ua = uaStr,
p = agent.platform,
@priithaamer
priithaamer / encode-decode.rb
Created July 28, 2011 06:46
Encode/Decode
require 'openssl'
require 'base64'
require 'digest/sha1'
c = OpenSSL::Cipher::Cipher.new("aes-128-cbc")
c.encrypt
# your pass is what is used to encrypt/decrypt
c.key = key = Digest::SHA1.hexdigest("whatever")
# c.iv = iv = c.random_iv
e = c.update("190")
e << c.final
@priithaamer
priithaamer / gist:1111111
Created July 28, 2011 06:48
Gist 1111111
require 'openssl'
require 'base64'
require 'digest/sha1'
c = OpenSSL::Cipher::Cipher.new("aes-128-cbc")
c.encrypt
# your pass is what is used to encrypt/decrypt
c.key = key = Digest::SHA1.hexdigest("whatever")
# c.iv = iv = c.random_iv
e = c.update("190")
e << c.final
@priithaamer
priithaamer / noir.rb
Created September 6, 2011 16:01
NOIRi päevapakkumised
#!/usr/bin/env ruby
require 'rubygems'
require 'nokogiri'
require 'open-uri'
print = false
doc = Nokogiri::HTML(open("http://www.cafenoir.ee/noir/"))
doc.css('table.contentpaneopen:nth-child(2) p').each do |p|