Skip to content

Instantly share code, notes, and snippets.

Niall O'Brien niallobrien

  • Waterford, Ireland
View GitHub Profile
View .jshintrc.js
// NOTE: I added the .js extension to this gist so it would have syntax highlighting. This file should have NO file extension
// Settings
"passfail" : false, // Stop on first error.
"maxerr" : 100, // Maximum error before stopping.
// Predefined globals whom JSHint will ignore.
"browser" : true, // Standard browser globals e.g. `window`, `document`.
akuzemchak /
Last active Jun 8, 2020
New L4 project with clean history
# Initial setup
git clone -o framework -b develop project-name
cd project-name
git checkout --orphan master
git commit -m "Initial commit"
# Pulling changes
git fetch framework
git merge --squash -m "Upgrade Laravel" framework/develop
# Fix merge conflicts if any and commit
fideloper / CodeTest.php
Created Nov 11, 2013
Example testing with in-memory SQLite database
View CodeTest.php
* Intention:
* "testing" environment has a SQLite database configured
* Run migrations against --env=testing
* Separate seeds run here per test method will delete the SQLite
* code tables, and re-create them with codes that fit the needs
treyrich / Example.js
Last active May 30, 2017
This is an AngularJS provider to communicate with a Sails.js backend via Socket.IO.After searching for way too long for a way to interface with the Sails.js client-side SDK included in new Sails projects via AngularJS I decided to write a drop in replacement for the AngularJS $http provider.Although this isn't a full replacement it includes a nu…
View Example.js
angular.module("MyApp", ["SocketProvider"])
.controller("MyController", ["$scope", "socket", function($scope, socket) {
// Fetch initial data
$scope.person = null;
socket.get("/person/1").success(function(data) {
$scope.person = data;
}).error(function() {
View wiredep.js
// inject bower components
gulp.task('wiredep', function () {
directory: './bower_components/'
tjFogarty / foundation-mq.js
Last active Aug 29, 2015
Check Foundation Media Queries
View foundation-mq.js
/* globals $, jQuery, Foundation */
/* jshint node:true */
'use strict';
window.MQ = (function(MQ, $, queries) {
* $cache elements
* @type {Object}

To implement API authentication in KeystoneJS, you need the following:

For key based authentication

  • Middleware that validates the key in the request body or a header

For session based authentication

  • An endpoint that handles signin
  • An endpoint that handles signout
tjFogarty / picture.twig
Created Feb 24, 2015
Picture element + Twig
View picture.twig
<!--[if IE 9]><video style="display: none;"><![endif]-->
<source srcset="{{ slide.image_desktop | tojpg | resize(1200) }}" media="(min-width: 1000px)">
<source srcset="{{ slide.image_tablet | tojpg | resize(800) }}" media="(min-width: 767px)">
<source srcset="{{ slide.image | tojpg | resize(480) }}, {{ slide.image | tojpg | resize(766) }} 2x" media="(max-width: 766px)">
<!--[if IE 9]></video><![endif]-->
<img class="slider__image" srcset="{{ slide.image_tablet | tojpg | resize(800) }}" alt="{{ slide.title }}">
tjFogarty / srcset.html
Created Feb 25, 2015
Example of srcset and sizes
View srcset.html
srcset="/path/to/slider-image-small.jpg 400w,
/path/to/slider-image-medium.jpg 800w,
/path/to/slider-image-large.jpg 1200w"
jodyheavener /
Created Aug 18, 2015
Use Babel (ES6) with Sails JS

Inspired by this issue, with these instructions you should be able to get Babel transpiling your JS in Sails JS for the client side.

  1. Install Grunt Babel npm install --save grunt-babel
  2. Create a babel.js file under tasks/config and add something like the following:
module.exports = function(grunt) {

    grunt.config.set('babel', {
      dev: {
You can’t perform that action at this time.