Skip to content

Instantly share code, notes, and snippets.

@goldhand
goldhand / omdLoadScreenSafty.js
Created August 28, 2015 22:33
Load screen helper for OMD. If
// <script type="text/javascript"> // remove the first two backslashes if pasting this into html
$(document).ready(function() { // document ready function
function loadScreenSafty() {
// Removes the loading class incase the library fails
var MILLISECONDS_FOR_LOAD_SCREEN_TO_FAIL = 5000; // change this to change delay time
function disableLoadScreens() {
@goldhand
goldhand / update_glueboss_json.py
Created August 28, 2015 22:39
Just run `$ python update_glueboss_json.py` from your terminal in the same folder as this file, glueboss-data.csv, and glueboss-data.json
import csv
import json
import sys
def main(argv):
'''
usage:
$ python update_json.py <glueboss-data.csv> <glueboss-data.json>
'''
@goldhand
goldhand / wpl_project_setup
Last active August 29, 2015 14:08
Django/Python Web Dev Setup
$ sudo apt-get install postgresql-9.3 postgresql-server-dev-9.3 curl libxslt-dev libpq-dev git python python-virtualenv
$ mkdir $VENV/$PROJECTNAME
$ virtualenv $VENV/$PROJECTNAME
$ source $VENV/$PROJECTNAME/bin/activate
$ cd $PROJECTS
$ mkdir $PROJECTNAME
$ cd $PROJECTNAME
class LocalCzar(Local):
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql_psycopg2',
'NAME': 'dtf',
'USER': 'charina',
}
}
@goldhand
goldhand / parallax
Created January 30, 2015 01:07
simple javascript parallax script
// Create cross browser requestAnimationFrame method:
window.requestAnimationFrame = window.requestAnimationFrame
|| window.mozRequestAnimationFrame
|| window.webkitRequestAnimationFrame
|| window.msRequestAnimationFrame
|| function(f){setTimeout(f, 1000/60)}
var parallaxElem = document.getElementById('parallax-content');
var scrollRate = .5; // move parallaxElem at 50% of scroll rate
@goldhand
goldhand / scrolling angular
Last active August 29, 2015 14:14
messing with scrolling in angularjs
$rootScope.scrollLevel = {
'one': false,
'two': false,
};
$rootScope.scrollY = window.pageYOffset;
$rootScope.scrollingDown = false;
$rootScope.scrollingUp = false
window.onscroll = function () {
if($rootScope.scrollY>window.pageYOffset){
$rootScope.scrollingDown = false;
@goldhand
goldhand / No Access Control Allow Origin Header is present
Created February 4, 2015 21:33
XMLHttpRequest cannot load {resource}. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin '{request_origin}' is therefore not allowed access
<CORSConfiguration>
<CORSRule>
<AllowedOrigin>*</AllowedOrigin>
<AllowedMethod>GET</AllowedMethod>
<MaxAgeSeconds>3000</MaxAgeSeconds>
<AllowedHeader>access-control-allow-origin</AllowedHeader>
<ExposeHeader>access-control-allow-origin</ExposeHeader>
</CORSRule>
</CORSConfiguration>
@goldhand
goldhand / selectColor.js
Created February 9, 2015 21:06
Selects a color based on "color" query
<script>
(function(){
function getQueryString() {
var queryString= [];
var hash;
var hashes = window.location.href.slice(window.location.href.indexOf('?') + 1).split('&');
for(var i = 0; i < hashes.length; i++)
{
hash = hashes[i].split('=');
queryString.push(hash[0]);
@goldhand
goldhand / vendor-colors-iframe.html
Last active August 29, 2015 14:15
You can modify the "height" parameter. Place this outside of any tags if you can.
<div class="iframe-container">
<iframe src="//glueboss.herokuapp.com/#/" width="1200" height="600" frameborder="0"></iframe>
</div>
<style>
.iframe-container {
position: relative;
padding-bottom: 75%;
height: 0;
overflow: hidden;
}
@goldhand
goldhand / shaky.css
Last active August 29, 2015 14:16
Shakes an element on hover
@-webkit-keyframes spaceboots {
0% { -webkit-transform: translate(2px, 1px) rotate(0deg); }
10% { -webkit-transform: translate(-1px, -2px) rotate(-1deg); }
20% { -webkit-transform: translate(-3px, 0px) rotate(1deg); }
30% { -webkit-transform: translate(0px, 2px) rotate(0deg); }
40% { -webkit-transform: translate(1px, -1px) rotate(1deg); }
50% { -webkit-transform: translate(-1px, 2px) rotate(-1deg); }
60% { -webkit-transform: translate(-3px, 1px) rotate(0deg); }
70% { -webkit-transform: translate(2px, 1px) rotate(-1deg); }
80% { -webkit-transform: translate(-1px, -1px) rotate(1deg); }