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]-->
<head>
<script>
(function() {
var html = document.getElementsByTagName('html')[0]
html.className = html.className.replace( /(?:^|\s)no-js(?!\S)/g , 'js' );
})()
</script>
@dansimco
dansimco / directive-as-a-service.js
Created Feb 3, 2014
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
dansimco / Gruntfile.js
Last active Aug 29, 2015
Modularized Gruntfile
View Gruntfile.js
module.exports = function(grunt) {
//Load private config if available
try {
app_config = grunt.file.readJSON('config.json');
} catch (err) {
console.log(
"\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
dansimco / uploadPhotoToFacebook.js
Created Jan 2, 2013
Posts a photo to a users profile, creating a gallery where needed.
View uploadPhotoToFacebook.js
/*global FB, alert, console */
//Usage
// uploadPhotoToFacebook({
// caption: 'A Picture',
// url: 'http://lorempixel.com/400/300/',
// album: 'JS API',
// album_description: "An album of pictures",
// onSuccess: function(){
@dansimco
dansimco / gist:3106555
Created Jul 13, 2012
InstantFileUploader
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 () {};
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;
if(
touchX > element_coords.left &&
touchX < element_coords.right &&
touchY > element_coords.top &&
@dansimco
dansimco / app.rb
Created May 29, 2012
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">
<div>
<input type="file" name="file" value="" id="file">
</div>
@dansimco
dansimco / SEHGymRules.md
Created May 15, 2012
Draft for SEH Gym rules poster
View SEHGymRules.md

##NSE Gym

##PICK UP AFTER YOURSELF

  • 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).

##NOISE

View gist:958397

#HBG

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.

##Services

  • Accountancy
View gist:767668
btn.addEvent('touchend',function(event){
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>spotCoords.top && touchY<spotCoords.bottom){
alert('TouchUpInside!!!');
} else {
alert('Touch up outside');
}
});