Skip to content

Instantly share code, notes, and snippets.

@dansimco
dansimco / uploadPhotoToFacebook.js
Created January 2, 2013 04:27
Posts a photo to a users profile, creating a gallery where needed.
/*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 / Gruntfile.js
Last active August 29, 2015 13:55
Modularized Gruntfile
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 / directive-as-a-service.js
Created February 3, 2014 08:22
Angular Directive as a Service
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);
<!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>