Skip to content

Instantly share code, notes, and snippets.

Niall O'Brien niallobrien

  • Waterford, Ireland
Block or report user

Report or block niallobrien

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View project-builds.md

TL;DR

Meteor is great at sharing code between different builds for different platforms. You can use the same source for your browser builds, server builds, your builds for iOS, Android, ... But how to organize your project to be able to orchestrate your builds for different apps and services from the same source? This post elaborates on the reasons why you need these different builds and how you could accomplish this with Meteor easily.

Use cases: Why would you build different apps?

1. Different apps for different roles

Say you have an app with completely different end user experiences depending on their role. It is common practice to have the user logged in, check her authorization (role) and then setup different routes or load different templates to serve that type of user’s needs. While doing so, all types of users load the same build and the app decides what portions of the build to use and what not to use.

@jodyheavener
jodyheavener / Instructions.md
Created Aug 18, 2015
Use Babel (ES6) with Sails JS
View Instructions.md

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: {
@tjFogarty
tjFogarty / srcset.html
Created Feb 25, 2015
Example of srcset and sizes
View srcset.html
<img
srcset="/path/to/slider-image-small.jpg 400w,
/path/to/slider-image-medium.jpg 800w,
/path/to/slider-image-large.jpg 1200w"
sizes="100vw"
alt="...">
@tjFogarty
tjFogarty / picture.twig
Created Feb 24, 2015
Picture element + Twig
View picture.twig
<picture>
<!--[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 }}">
@JedWatson
JedWatson / API-Auth-With-KeystoneJS.md
Last active Jul 17, 2019
API Auth with KeystoneJS
View API-Auth-With-KeystoneJS.md

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
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}
View wiredep.js
// inject bower components
gulp.task('wiredep', function () {
gulp.src('./partials/*.php')
.pipe(wiredep({
directory: './bower_components/'
}))
.pipe(gulp.dest('./partials'));
});
@treyrich
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() {
@fideloper
fideloper / CodeTest.php
Created Nov 11, 2013
Example testing with in-memory SQLite database
View CodeTest.php
<?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
@akuzemchak
akuzemchak / l4project.sh
Last active Feb 25, 2019
New L4 project with clean history
View l4project.sh
# Initial setup
git clone -o framework -b develop https://github.com/laravel/laravel.git 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
You can’t perform that action at this time.