Skip to content

Instantly share code, notes, and snippets.

View nateabele's full-sized avatar

Nate Abele nateabele

View GitHub Profile
<?php
/* ... */
/**
* Allows each Mongo collection to have a sequence ID for numbering objects.
*
* @param array $scope The scope for this counter. A scope is an array of key/value pairs
* that represent the conditions used to group this sequence. For example, a
* scope may be the ID of a company, allowing each company to have their own
@nateabele
nateabele / api_messages
Last active August 29, 2015 14:05
Angular Workshop Draft 2
[
{
"from": "Nate",
"to": "Everybody",
"subject": "Doing a demo",
"body": "Hope I don't screw this up"
},
{
"from": "Everybody",
"to": "Nate",
@nateabele
nateabele / makeicon
Created September 10, 2014 20:29
Cross-platform tool for generating icons from PNGs, see https://korewanetadesu.com/make-icons.html
ICONUTIL := $(word 1, $(shell command -v iconutil icnsutil) iconutil)
.SECONDEXPANSION:
%.icns: %.iconset $$(wildcard $$(@D)/$$*.iconset/icon_*.png)
$(ICONUTIL) -c icns -o $@ $<
.SECONDEXPANSION:
%.ico: %.iconset $$(wildcard $$(@D)/$$*.iconset/icon_*[0-9].png)
convert -background transparent -colors 256 $(filter-out $<,$^) $@
import R from 'ramda';
let { is, complement, filter, map, mapObj, mapObjIndexed, prop, pipe, identity, mergeAll, toLower } = R;
class Domp {
constructor() {
this.propMap = {
name: pipe(prop('nodeName'), toLower),
type: prop('nodeType'),
@nateabele
nateabele / SepiaToneFilter.php
Created April 13, 2012 20:59
Proof-of-concept sepia tone filter for Imagine. My math is probably rong.
<?php
namespace moneygram\extensions\imagine;
use Imagine\Image\Box;
use Imagine\Image\Point;
use Imagine\Image\Color;
class SepiaToneFilter implements \Imagine\Filter\FilterInterface {
@nateabele
nateabele / Gulpfile.babel.js
Last active November 10, 2015 14:39
In Search of the One True Gulpfile – http://radify.io/blog/one-true-gulpfile/
import gulp from 'gulp';
import gif from 'gulp-if';
import smaps from 'gulp-sourcemaps';
import babel from 'gulp-babel';
import concat from 'gulp-concat';
import uglify from 'gulp-uglify';
import jas from 'gulp-jasmine';
import conn from 'gulp-connect';
import yargs from 'yargs';
import config from './package.json';
@nateabele
nateabele / action.php
Last active December 17, 2015 20:28
Example of configuring `li3_resources` queries to automatically extract values from request parameters, with fallbacks to default values. **Note:** exposing elements of a query to arbitrary input (i.e., high query limits) is not advisable. The needs and context of the application should always be considered, and input should be filtered and/or s…
<?php
/**
* Snippet extracted from `config/bootstrap/action.php`.
*/
/**
* ## Mapping HTTP Request Parameters to Query Parameters
*
* The `$replacer` function is used by the `Resources` filter below to allow resource classes to
* automatically map values from the `Request` object in their query configurations.
@nateabele
nateabele / libraries.php
Created September 23, 2013 14:30
How to integrate Stripe with Lithium
<?php
/** config/bootstrap/libraries.php **/
// ...
Libraries::add('stripe', array(
'path' => LITHIUM_APP_PATH . '/libraries/stripe/lib',
'prefix' => null
));
@nateabele
nateabele / Users.php
Last active December 23, 2015 17:59
Get the current user as an object
<?php
/** models/Users.php **/
use lithium\security\Auth;
class Users extends \lithium\data\Model {
// ...
@nateabele
nateabele / debug.js
Created September 26, 2013 17:14
Karma configuration for debugging UI-Router.
module.exports = function(config) {
config.set({
// base path, that will be used to resolve files and exclude
basePath: '.',
// list of files / patterns to load in the browser
files: [
'lib/angular-1.1.4.js',
'test/lib/angular-mocks-1.1.4.js',
'test/testUtils.js',