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: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() {
@zacharyblank
zacharyblank / gist:a8383da151ef977d77ef
Last active August 29, 2015 14:05
Gulp Error Notifications
var plumber = require('gulp-plumber');
var gutil = require('gulp-util');
var onError = function(err) {
gutil.beep();
console.error("You did something wrong, NERD! " + err.message);
}
gulp.task('less', function() {
gulp.src('app/src/less/main.less')
# Generated by iptables-save v1.4.21 on Thu Sep 18 12:53:41 2014
*nat
:PREROUTING ACCEPT [378:24243]
:INPUT ACCEPT [48:2690]
:OUTPUT ACCEPT [9616:597220]
:POSTROUTING ACCEPT [9616:597220]
-A PREROUTING -i eth0 -p tcp -m tcp --dport 80 -j REDIRECT --to-ports 8080
-A PREROUTING -i eth0 -p tcp -m tcp --dport 443 -j REDIRECT --to-ports 8080
-A POSTROUTING -s 10.8.0.0/24 -o eth0 -j MASQUERADE
COMMIT
@zacharyblank
zacharyblank / gist:54732d363cf1a461cfc6
Created September 21, 2014 16:54
Category Styles
.categories {
ul {
li {
width: 200px;
text-align: center;
.font-size(1.6);
display: inline-block;
margin: 0 36px;