Skip to content

Instantly share code, notes, and snippets.

View gist:4dda60eb326573e055f7
<!doctype html>
<!--[if (IE 9) & (!IEMobile)]> <html class="no-js ie-9" lang="en-au"> <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js" lang="en-au"> <!--<![endif]-->
(function() {
var html = document.getElementsByTagName('html')[0]
html.className = html.className.replace( /(?:^|\s)no-js(?!\S)/g , 'js' );
dansimco / directive-as-a-service.js
Created February 3, 2014 08:22
Angular Directive as a Service
View directive-as-a-service.js
angular.module('MyComponent', [])
.service('MyComponent', function($log, $rootScope, $compile) {
return function(params) {
var scope;
// Pass params through to a new'd up scope.
// I'm just shoving them all in there as a property
// but you could be more discreet.
scope = $rootScope.$new();
scope.params = params;
var directive = $compile('<my-component>')(scope);
dansimco / Gruntfile.js
Last active August 29, 2015 13:55
Modularized Gruntfile
View Gruntfile.js
module.exports = function(grunt) {
//Load private config if available
try {
app_config = grunt.file.readJSON('config.json');
} catch (err) {
"\n\nNo config file found. Some tasks may require config strings such as AWS keys or DB strings" +
"Please create one based on config.sample.json\n\n"
dansimco / uploadPhotoToFacebook.js
Created January 2, 2013 04:27
Posts a photo to a users profile, creating a gallery where needed.
View uploadPhotoToFacebook.js
/*global FB, alert, console */
// uploadPhotoToFacebook({
// caption: 'A Picture',
// url: '',
// album: 'JS API',
// album_description: "An album of pictures",
// onSuccess: function(){
dansimco / gist:3106555
Created July 13, 2012 18:38
View gist:3106555
/*global Element, IFrame, document, Button */
var InstantFileUploader;
InstantFileUploader = function (input, params) {
"use strict";
var self = this;
self.frameId = String.uniqueID();
self.loading = false;
self.onComplete = params.onComplete || function () {};
dansimco / gist:3067704
Created July 7, 2012 19:08
View gist:3067704
isTouchInside = function(e){
var event = e.originalEvent;
touch_inside = false;
if (! event.touches[0] ) return touch_inside;
touchX = event.touches[0].pageX;
touchY = event.touches[0].pageY;
touchX > element_coords.left &&
touchX < element_coords.right &&
touchY > &&
dansimco / app.rb
Created May 29, 2012 15:09
Concise Sinatra Amazon S3 Upload Example
View app.rb
require "rubygems"
require 'sinatra'
require "aws/s3"
get '/' do
return %Q{
<form action="upload" method="post" accept-charset="utf-8" enctype="multipart/form-data">
<input type="file" name="file" value="" id="file">
dansimco /
Created May 15, 2012 21:05
Draft for SEH Gym rules poster

##NSE Gym


  • Return weight plates, bars and dumbbells to their designated places when not in use.
  • Throw your paper towels and rubbish in the trash.
  • DO NOT leave dumbbells on the floor or weight plates on the bar.
  • If you move equipment, put it back where it belongs (Otherwise the porters are unable to clean the gym effectively).


View gist:958397


Financially distressed businesses within Australia seeking re-engineering, re-structuring and a strategy to trade out of their existing problem. Businessess seeking support of corporate strategists to grow their business, protect their assets and investigate new areas. Businesses that have grown beyond their resources and want to bring on a specialised level of accounting and business support. High net worth individuals seeking personal advisor and gatekeeper.


  • Accountancy
dansimco / gist:767668
Created January 6, 2011 08:10
View gist:767668
var touchX = event.event.changedTouches[0].pageX;
var touchY = event.event.changedTouches[0].pageY;
var spotCoords = btn.getCoordinates();
if(touchX>spotCoords.left && touchX<spotCoords.right && touchY> && touchY<spotCoords.bottom){
} else {
alert('Touch up outside');