Skip to content

Instantly share code, notes, and snippets.

@stugoo
stugoo / gist:2711536
Created May 16, 2012 15:54
session / local storage switcher
shortlistings = {
storeInSession: true,
killFunctions : function() {
// kill the functions
}
setStorage : function(type,store) {
var JSON_str = '';
JSON_str = JSON.stringify(store);
@stugoo
stugoo / checker.js
Created May 24, 2012 11:02
array builder for nesting arrays, checking categories and flange
var items = [];
// We're emulating indexOf, but for objects in the array.
// The function returns an integer (>=0), to the object that matched.
function in_property_array(property, value, arr) {
var i, max = arr.length, current;
for (i = 0; i < max; i++) {
if (arr[i][property] === value) {
return i;
@stugoo
stugoo / git clean up
Created June 24, 2012 16:53
cleanup deleted files in git
git add . -A
@stugoo
stugoo / html
Created July 4, 2012 10:23
datetime ticker
<article class="clock">
<ul>
<li class="time">
<h1>time</h1>
<time>
<span class="hours"></span>
<span class="minutes"></span>
<span class="seconds"></span>
</time>
@stugoo
stugoo / css
Created October 2, 2012 11:33
Stacked photo css only
.blocky_hold{
height: 101px;
width: 135px;
position: relative;
display: block;
}
.blocky{ border: 1px solid #fff;
height: 101px;
width: 135px;
display: block;
@stugoo
stugoo / index.html
Created October 12, 2012 16:38
simple jquery overlay
<body>
<a href="#linkToTsnCs" class="showTerms">terms &amp; conditions</a>
<body>
@stugoo
stugoo / gist:4724127
Last active December 12, 2015 05:48
File upload Preview // single file
fileUploadPreview = function () {
var self = this,
uploader = document.getElementById("files"),
output = document.getElementById('preview_image'),
initialise = function() {
uploader.addEventListener('change', handleFileSelect, false);
@stugoo
stugoo / gist:4731031
Created February 7, 2013 13:49
Get src attribute from string
var input = '<iframe width="560" height="315" src="http://www.youtube.com/embed/_QtoHqZPkk0" frameborder="0" allowfullscreen></iframe>',
rawurl = new String(input).match(/src=["']?((?:.(?!["']?\s+(?:\S+)=|[>"']))+.)["']?/)[1];
@stugoo
stugoo / markup.html
Last active December 12, 2015 06:58
vanilla JS tabbed content
<h2>Tabs</h2>
<ul id="tab_list">
<li><a href="#tab01">tab 01</a></li>
<li><a href="#tab02">tab 02</a></li>
<li><a href="#tab03">tab 03</a></li>
</ul>
<div id="tab_content_container">
<div id="tab01" class="tab_content">
<h1>tab 01</h1>
<br>
@stugoo
stugoo / gist:4754905
Created February 11, 2013 14:59
get value from a querystring
function getParameterByName(name)
{
name = name.replace(/[\[]/, "\\\[").replace(/[\]]/, "\\\]");
var regexS = "[\\?&]" + name + "=([^&#]*)";
var regex = new RegExp(regexS);
var results = regex.exec(window.location.search);
if(results == null)
return "";
else
return decodeURIComponent(results[1].replace(/\+/g, " "));