Skip to content

Instantly share code, notes, and snippets.

@hamishhossack
hamishhossack / 0_reuse_code.js
Last active August 29, 2015 14:06
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@hamishhossack
hamishhossack / css_resources.md
Last active August 29, 2015 14:06 — forked from jookyboi/css_resources.md
CSS libraries and guides to bring some order to the chaos.

Libraries

  • 960 Grid System - An effort to streamline web development workflow by providing commonly used dimensions, based on a width of 960 pixels. There are two variants: 12 and 16 columns, which can be used separately or in tandem.
  • Compass - Open source CSS Authoring Framework.
  • Bootstrap - Sleek, intuitive, and powerful mobile first front-end framework for faster and easier web development.
  • Font Awesome - The iconic font designed for Bootstrap.
  • Zurb Foundation - Framework for writing responsive web sites.
  • SASS - CSS extension language which allows variables, mixins and rules nesting.
  • Skeleton - Boilerplate for responsive, mobile-friendly development.

Guides

@hamishhossack
hamishhossack / StorageManager.js
Created July 27, 2015 14:35
Local Storage Manager (timestamped, extra functionality, session & local storage) Deps: [underscore]
var CacheManager = window.CacheManager = function (storage) {
var name = '';
if (typeof storage !== "string") {
throw new TypeError('The name of storage needs to be a character string.');
}
name = _.capitalize(storage) + 'Storage';
@hamishhossack
hamishhossack / TwigTemplateManager.js
Created July 27, 2015 14:38
Override Marionette With Twig Templates (use cache templates)
var loadExistingTwigTemplate = function (templateId) {
return Twig.twig({
ref: templateId
});
};
Marionette.TemplateCache.prototype.compileTemplate = function (template) {
switch (template.type) {
case 'twig/template':
// first, see if the template is already loaded
@hamishhossack
hamishhossack / CropManager.js
Created July 27, 2015 14:40
Image Cropping Manager (needs optimising)
var Crop = {
elements: {
editor: null,
container: null,
slider: null,
img: null,
overlay: null,
preview: null
},
@hamishhossack
hamishhossack / isURL.js
Created July 27, 2015 14:40
isUrl Test
var isURL = function isUrl(s) {
var regexp = /(ftp|http|https):\/\/(\w+:{0,1}\w*@)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-\/]))?/
console.info('Is URL ? ', regexp.test(s));
return regexp.test(s);
};
@hamishhossack
hamishhossack / GoogleAS.js
Created July 27, 2015 14:42
Backbone Integration for googleAdSense
window.adsbygoogle = window.adsbygoogle || [];
var async = ( typeof c != "undefined" && !_.isUndefined(c.script) ) ? c.sript : $.getScript;
async("//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js");
var GoogleAS = new Backbone.Model({
id: 'GoogleAS',
client: 'pub-9565436045946419',
currentCount: 0,
maxSlots: 3,
@hamishhossack
hamishhossack / SymfonyGulp.js
Last active February 25, 2017 10:57
Symfony 2 with Gulp for Front-End Assets (optimize & make universal)
var gulp = require('gulp');
var uglify = require('gulp-uglify');
var uglifycss = require('gulp-uglifycss');
var less = require('gulp-less');
var rjs = require('requirejs').optimize;
var concat = require('gulp-concat');
var bower = require ('gulp-bower');
var watch = require('gulp-watch');
var batch = require('gulp-batch');
var path = require('path');
@hamishhossack
hamishhossack / SimpleHTTPServer
Created August 3, 2015 12:41
Simple web server on MAC
python -m SimpleHTTPServer 8000
@hamishhossack
hamishhossack / gist:96f8b6f766934d85c2d4
Created October 20, 2015 15:05 — forked from eparreno/gist:1845561
Install libmagic on Mac OS X via homebrew
$ brew install libmagic
$ brew link libmagic (if the link is already created is going to fail, don't worry about that)
$ env ARCHFLAGS="-arch x86_64" gem install ruby-filemagic -- --with-magic-include=/usr/local/include --with-magic-lib=/usr/local/lib/