Skip to content

Instantly share code, notes, and snippets.

View gtallen1187's full-sized avatar
🤪

Greg Allen gtallen1187

🤪
View GitHub Profile
@gtallen1187
gtallen1187 / jsNestedToHead.js
Created August 1, 2014 07:46
append multiple scripts to the head, nested for depency
//add multiple scripts to head (nested when they depend on each other)
$.getScript("https://ajax.aspnetcdn.com/ajax/jquery.dataTables/1.9.4/jquery.dataTables.min.js", function () {
$.getScript("https://datatables.net/release-datatables/extras/TableTools/media/js/TableTools.min.js",function(){
alert("your resources are ready!")
})
})
@gtallen1187
gtallen1187 / cssAppendToHead.js
Created August 1, 2014 07:47
two ways to append a stylesheet reference to the head
//
// Script for adding external CSS stylesheet to DXP
//
var myStylesLocation = 'http://www.ecwincentives.com/assets/css/bootstrap.min.css'
$('<link rel="stylesheet" type="text/css" href="'+myStylesLocation+'" >')
.appendTo("head");
@gtallen1187
gtallen1187 / find-servers
Created August 16, 2014 21:24
find all running servers on port 3000
lsof -i tcp:3000
@gtallen1187
gtallen1187 / findDjango.py
Created August 16, 2014 22:11
find django source files
python -c "
import sys
sys.path = sys.path[1:]
import django
print(django.__path__)"
from django import http
from django.conf import settings
from django.core import urlresolvers
from django.shortcuts import get_object_or_404, redirect
from django.utils import simplejson
from django.utils.encoding import force_unicode
from yabl.authors.models import Author
class RESTResource(object):
"""
@gtallen1187
gtallen1187 / .gitignore
Last active August 29, 2015 14:05
global .gitignore that will ignore the following file types for all git repos on your computer
# Compiled source #
###################
*.com
*.class
*.dll
*.exe
*.o
*.so
# Packages #
@gtallen1187
gtallen1187 / helpers.js
Last active August 29, 2015 14:05
handy functions
// code in here is executed once the entire page loads
$( window ).load(function() { ... })
// the classic
$( document ).ready(function() { ... });
<link rel="import" href="../google-map/google-map.html">
<polymer-element name="my-element">
<template>
<style>
:host {
position: absolute;
width: 100%;
height: 100%;
@gtallen1187
gtallen1187 / findDbUpdates.sql
Last active August 29, 2015 14:07
find all DB changes within last 5 minutes
SELECT
CONCAT(TABLE_SCHEMA, '.', TABLE_NAME) AS 'Table',
UPDATE_TIME AS 'Updated'
FROM INFORMATION_SCHEMA.TABLES
WHERE DATE_SUB(NOW(), INTERVAL 5 Minute) < UPDATE_TIME AND TABLE_SCHEMA != 'INFORMATION_SCHEMA' AND TABLE_TYPE = 'BASE TABLE'