Skip to content

Instantly share code, notes, and snippets.

View haggen's full-sized avatar

Arthur Corenzan haggen

View GitHub Profile
@haggen
haggen / hookshot.js
Created March 25, 2011 00:27
Make hash anchors scroll smoothly
/**
* Hookshot v1.1
* jQuery plugin for fragment anchors to scroll smoothly
* by Arthur Corenzan <arthur@corenzan.com>
* Creative Commons-Attribution-Share Alike
* http://creativecommons.org/licenses/by-sa/3.0
*
* Usage:
*
* Target the anchors you want to enable smoothly
@haggen
haggen / jquery-plugin-boilerplate.js
Created May 14, 2011 02:32
jQuery plugin simple boilerplate
/**
* jQuery plugin simple boilerplate v1.0
* by Arthur Corenzan <arthur@corenzan.com>
* Creative Commons-Attribution-Share Alike
* http://creativecommons.org/licenses/by-sa/3.0
*/
(function($) {
//name your plugin
$.fn.PLUGIN = function(o) {
@haggen
haggen / squire.js
Created May 24, 2011 17:55
Make targeted elements scroll with the window
/**
* Squire v1.0
* Make targeted elements scroll with the window
* by Arthur Corenzan <arthur@corenzan.com>
* Creative Commons-Attribution-Share Alike
* http://creativecommons.org/licenses/by-sa/3.0
*
* Under development...
*/
@haggen
haggen / prime.rb
Created May 27, 2011 16:20
Find out if given number is prime
#!/usr/bin/ruby
# Find out if given number is prime
# based on http://zmievski.org/2010/08/the-prime-that-wasnt by ANDREI ZMIEVSKI
# inspired by http://pastebin.com/PGT94gdF by MAURO BARALDI
def prime?(n)
n = '1' * n.to_i
n == '1' or !n[/^1?$|^(11+?)\1+$/]
end
@haggen
haggen / .vimrc
Last active September 26, 2015 13:27
My personal .vimrc in Mac
" make vim more useful
set nocompatible
" enhance command-line completion
set wildmenu
" allow cursor keys in insert mode
set esckeys
" optimize for fast terminal connections
@haggen
haggen / utility-belt.js
Last active December 9, 2015 06:48
JavaScript utility belt
//github.com/jed/140bytes/wiki/Byte-saving-techniques
Number.prototype.isPrime = function(n) {
var n = '1'.repeat(this);
return !n.match(/^1?$|^(11+?)\1+$/gi);
};
//
String.prototype.repeat = function(n) {
@haggen
haggen / Gemfile
Created December 12, 2011 23:01
Password management
source 'http://rubygems.org'
gem 'fast-aes'
@haggen
haggen / dabblet.css
Created January 11, 2012 03:31
The first commented line is your dabblet’s title
/**
* The first commented line is your dabblet’s title
*/
body {
background: black linear-gradient(left, transparent, #f06);
}
div {
margin: 80px auto;
@haggen
haggen / dabblet.css
Created March 6, 2012 17:40
Untitled
body { background: #f0f0f0; font: 14px/1.4 sans-serif }
div {
background: white;
box-shadow: 0 0 4px #aaa;
width: 480px;
min-height: 120px;
margin: 20px auto;
padding: 16px 16px 0;
}
div div {
@haggen
haggen / dabblet.css
Created March 14, 2012 20:04
Untitled
body{font: 14px/1.6 sans-serif;}
* {margin: 0; padding: 0;}
body {
background: #666;
color: #f0f0f0;
}
a {
color: #fff;