Skip to content

Instantly share code, notes, and snippets.

View Haraldson's full-sized avatar

Hein Haraldson Berg Haraldson

View GitHub Profile
var Slider = function(args)
{
this.initialize(args);
}
Slider.prototype = {
initialize: function(args)
{
this.setSliderWidth(args);
@Haraldson
Haraldson / jQuery.inputTextReplacer.js
Created February 24, 2013 20:16
Generelt script for hjelpetekster som verdier i skjemafelter, for nettlesere hvor HTML5s placeholder-attributt ikke støttes.
(function($)
{
var SemanticInputTextReplacer = function(args)
{
if($(args.inputs).length > 0)
this.init(args);
};
SemanticInputTextReplacer.prototype = {
placeholderSupport: false,
@Haraldson
Haraldson / jQuery.genericContentFader.js
Created February 24, 2013 20:12
Generell innholdsfader.
var GenericFader = function(args)
{
if($(args.selector.wrap).length)
{
this.initialize(args);
}
};
GenericFader.prototype = {
initialize: function(args)
@Haraldson
Haraldson / ekornes-flip-rotation.js
Created February 24, 2013 18:31
Forsiderotasjon som sett på ekornes.no (nettstedet er senere flyttet, men utseende og funksjonalitet er bevart).
if(typeof jQuery !== 'undefined')
{
function FlipRotation(args)
{
if($(args.selector.wrap).length)
{
this.initialize(args);
}
}
@Haraldson
Haraldson / tracking.js
Created November 16, 2012 11:14
Fjord Tours tracking hack
if(!Array.prototype.indexOf)
{
Array.prototype.indexOf = function (searchElement /*, fromIndex */ ) {
"use strict";
if (this == null) {
throw new TypeError();
}
var t = Object(this);
var len = t.length >>> 0;
if (len === 0) {
@Haraldson
Haraldson / tracking.js
Created November 15, 2012 16:30
Fjord Tours tracking alpha
if(!Array.prototype.indexOf)
{
Array.prototype.indexOf = function (searchElement /*, fromIndex */ ) {
"use strict";
if (this == null) {
throw new TypeError();
}
var t = Object(this);
var len = t.length >>> 0;
if (len === 0) {
@Haraldson
Haraldson / external.js
Created November 13, 2012 17:12
FB.init + external scripts depending on the SDK being fully loaded
$(function()
{
// Listen to custom event and add more Facebook SDK dependent functionality
$(document).bind('fbAsyncInit', function()
{
FB.XFBML.parse($FacebookLikeButton);
FB.Event.subscribe('edge.create', function(response)
{
// Fire an AJAX call to increase the like count in the local database
@Haraldson
Haraldson / plupload-example-implementation.js
Created September 12, 2012 10:42
PLUpload example implementation
var uploader;
$(function()
{
uploader = new plupload.Uploader(
{
runtimes: 'flash,html5,html4',
container: 'upl-img-wrap',
browse_button: 'edit-user-upload-image',
max_file_size: '4mb',
@Haraldson
Haraldson / .gitignore
Created July 9, 2012 12:43
Git ignore
.*
compiled/
@Haraldson
Haraldson / .gitconfig
Created July 9, 2012 12:38
Git configuration
[alias]
st = status
br = branch
ci = commit --no-verify
out = push
in = pull --summary
type = cat-file -t
dump = cat-file -p
hi = log --pretty=format:'%h | %ad | %s%d [%an]' --date=short
hime = log --pretty=format:'%h | %ad | %s' --date=short --author=username