Skip to content

Instantly share code, notes, and snippets.

@neilff
neilff / responsive-css-module
Created August 25, 2014 15:24
Simple mobile first CSS module
/**
* Mobile
*/
.example {
}
/**
* Tablet Vertical
*/
@neilff
neilff / gist:9163486
Created February 22, 2014 22:40
cleaned-up-facebook-sdk-simple
<!-- These are the notifications that are displayed to the user through pop-ups if the above JS files does not exist in the same directory-->
if ((typeof cordova == 'undefined') && (typeof Cordova == 'undefined')) alert('Cordova variable does not exist. Check that you have included cordova.js correctly');
if (typeof CDV == 'undefined') alert('CDV variable does not exist. Check that you have included cdv-plugin-fb-connect.js correctly');
if (typeof FB == 'undefined') alert('FB variable does not exist. Check that you have included the Facebook JS SDK file.');
FB.Event.subscribe('auth.login', function(response) {
alert('auth.login event');
});
FB.Event.subscribe('auth.logout', function(response) {
@neilff
neilff / router.js
Created February 21, 2014 16:52
ui-router-example
$stateProvider
.state('age-gate', {
url: '/',
templateUrl: 'views/age-gate.html',
controller: 'AgeGateCtrl'
})
.state('home', {
url: '/home',
templateUrl: 'views/home.html',
@neilff
neilff / nodejs-read-write-example-async
Created December 19, 2013 17:22
nodejs-read-write-example-async
var fs = require('fs');
var myData = {
name:'test',
version:'1.0'
},
outputFilename = 'my.json';
// Write cache file
fs.writeFile(outputFilename, JSON.stringify(myData, null, 4), function(err) {
@neilff
neilff / nodejs-create-read-file-example
Created December 19, 2013 17:14
nodejs-create-read-file-example
var fs = require('fs');
var myData = {
name:'test',
version:'1.0'
},
outputFilename = 'my.json';
// Write cache file
fs.writeFileSync(outputFilename, JSON.stringify(myData, null, 4));
@neilff
neilff / angular-http-service
Created December 14, 2013 20:39
angular-http-service
define(
[ 'app', 'services' ],
function ( app, services ) {
return angular.module('drivecam.services').service('RequestService',
['SessionService', '$http', '$resource', '$rootScope', '$cookies',
function(SessionService, $http, $resource, $rootScope, $cookies) {
/**
* @param config {object} - Object which contains all the configuration settings for $http
* @return {object} - $http object which success and error methods
@neilff
neilff / Wordpress Sitemap: Recursive Function
Last active December 22, 2015 00:39
Wordpress Sitemap: Recursive Function
/**
* check_for_children
*
* This recursive function retrieves all the sitemap pages, it calls itself
* until the children pages for that node are exhausted
*
*/
function check_for_children( $region_id, $children, $type = 1 ) {
if ( count($children) > 0 ) {
@neilff
neilff / .profile
Created July 30, 2013 15:01
.profile for Terminal access -- Based on Tyler Savery's .profile from jQueryTO 2013
export CLICOLOR=1
export PATH="/bin:/sbin:/usr/bin:/usr/local/sbin:/Users/nfento/local/lib/node_modules/:/Users/nfento/local/bin/:$PATH"
export EDITOR='subl -w'
# define colors
C_DEFAULT="\[\033[m\]"
C_WHITE="\[\033[1m\]"
C_BLACK="\[\033[30m\]"
C_RED="\[\033[31m\]"
@neilff
neilff / basic-jquery-accordion
Created July 23, 2013 15:55
Basic jQuery Accordion -- Allows user to click twice on the same accordion, which will result in closing the select panel
//
// jQuery
//
;(function (window, document, $) {
// target all panels
var allPanels = $('div.main-links > div.collapse > ul');
$('a.toggle').on('click', function (e) {
@neilff
neilff / terminal-commands
Created July 17, 2013 17:18
Useful terminal commands
Open .profile
--------------------------------------------------
nano ~/.profile
Create an alias (in profile)
--------------------------------------------------
alias new_name='command to be performed'