Skip to content

Instantly share code, notes, and snippets.

View zacharyblank's full-sized avatar

Zach Blank zacharyblank

  • Hurry
  • Portland
View GitHub Profile
@zacharyblank
zacharyblank / gist:7136073
Created October 24, 2013 12:08
OS X Mavericks Vagrant NFS workaround
config.vm.share_folder("api", "/vagrant/api", "./api", :owner => "www-data", :group => "www-data", :extra => "dmode=775,fmode=644")
@zacharyblank
zacharyblank / gist:8326104
Created January 8, 2014 22:53
Custom Grant Type
<?php
/**
* OAuth 2.0 Password grant
*
* @package php-loep/oauth2-server
* @author Alex Bilbie <hello@alexbilbie.com>
* @copyright Copyright (c) 2013 PHP League of Extraordinary Packages
* @license http://mit-license.org/
* @link http://github.com/php-loep/oauth2-server
*/
App::before(function($request)
{
header('Access-Control-Allow-Methods: GET, POST, PUT, OPTIONS');
header('Access-Control-Allow-Origin: *');
header("Access-Control-Allow-Headers: Origin, X-Requested-With, Content-Type, Accept, Authorization");
if ($_SERVER['REQUEST_METHOD'] == 'OPTIONS') {
exit;
}
@zacharyblank
zacharyblank / gist:8707529
Created January 30, 2014 12:36
Resolve this in your private routes
'use strict'
define([], function () {
function getCurrentUser() {
function loader($q, $http, config) {
var defer = $q.defer();
$http.get(config.api + '/me', { authentication:true }).then(function(user) {
defer.resolve(user);
public function findByVendorIdByMonth($vendor, $id)
{
$data = $this->select(DB::raw("DATE_FORMAT(date, '%Y-%m-01 00:00:00') as date, SUM(views) as views, SUM(uniques) as uniques, SUM(inquiries) as inquiries"))
->groupBy(DB::raw("YEAR(date), MONTH(date)"))
->whereBetween('date', [date('Y-m-d 00:00:00', strtotime('-1 year')), date('Y-m-d 00:00:00', strtotime('today'))])
->where('vendor_type', $vendor)
->where('vendor_id', $id)->get();
$monthly = ['totals' => [
'uniques' => 0,
# ************************************************************
# Sequel Pro SQL dump
# Version 4096
#
# http://www.sequelpro.com/
# http://code.google.com/p/sequel-pro/
#
# Host: 8af2809e293652e222219d91ac59e78895a811b2.rackspaceclouddb.com (MySQL 5.1.72-2)
# Database: master
# Generation Time: 2014-04-05 13:37:32 +0000
@zacharyblank
zacharyblank / gist:db7b46b5b478f6e00c70
Created June 5, 2014 20:18
Start gulp when starting development server
var gulp = require('child_process').spawn('gulp', [], {stdio:'inherit'})
App::before(function($request)
{
header('Access-Control-Allow-Methods: GET, POST, PUT, DELETE, OPTIONS');
header('Access-Control-Allow-Origin: *');
header("Access-Control-Allow-Headers: Origin, X-Requested-With, Content-Type, Accept, Authorization");
if ($_SERVER['REQUEST_METHOD'] == 'OPTIONS') {
exit;
}
@zacharyblank
zacharyblank / gist:653202a1498bbbdc096c
Created June 25, 2014 15:14
Hungryinc.com Particle Background
'use strict'
module.exports = function($window) {
return {
restrict: 'E',
template: "<canvas id='space' width='{{ width }}' height='{{ height }}'></canvas>",
replace: true,
link: function($scope, element, attr) {
var ctx = element[0].getContext('2d'),
dist,
@zacharyblank
zacharyblank / resolution.js
Last active August 29, 2015 14:03
Watch for screen resolution change
'use strict'
module.exports = function() {
if ( ! watchers) var watchers = [];
var watchResolution = (function watchResolution() {
var devicePixelRatio = window.devicePixelRatio;
setTimeout(function() {