Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View andrewhl's full-sized avatar

Andrew Hlavats andrewhl

View GitHub Profile
(() => {
const range = (num) => {
return [...Array(num).keys()].map(n => n+1)
}
const productEqualsSum = (a, b, number) => {
const sum = ((number * (number+1)) / 2) - (a+b);
return a*b === sum;
}
var PasswordValidator = function () {
var errors = [];
return {
errors: errors,
validateLength: function(password) {
if (password.length < 6) {
errors.push('The password must be at least 6 characters long.')
}
},
public function scopeByInStore($query)
{
$inStoreOrderType = GiftCardOrderTypes::$inStore;
$id = GiftCardBatch::where('name', '=', $inStoreOrderType)->first()->id;
$inStoreGiftCardIds = GiftCard::where('gift_card_batch_id', '=', $id)
->lists('id');
return $query->whereIn('gift_card_id', $inStoreGiftCardIds);
}
public function scopeByInStore($query)
{
return GiftCardTransaction::whereHas('GiftCard', function ($query)
{
$query->whereHas('GiftCardBatch', function ($query)
{
$inStoreOrderType = GiftCardOrderTypes::$inStore;
$id = GiftCardBatch::where('name', '=', $inStoreOrderType)->first()->id;
$query->where('id', $id);
});
# TYPE DATABASE USER ADDRESS METHOD
# "local" is for Unix domain socket connections only
local all all peer
# IPv4 local connections:
host all all 127.0.0.1/32 ident
# IPv6 local connections:
host all all ::1/128 ident
# Allow replication connections from localhost, by a user with the
# replication privilege.
'use strict';
var DomService = function (ng) {
return {
get: function(selector) {
return ng.element(selector);
}
};
};
var gulp = require('gulp'),
notify = require('gulp-notify'),
phpspec = require('gulp-phpspec'),
browserify = require('gulp-browserify'),
sass = require('gulp-sass'),
compass = require('gulp-compass');
gulp.task('phpspec', function() {
var options = {notify: false};
gulp.src('app/spec/**/*.php')
@andrewhl
andrewhl / view
Last active August 29, 2015 14:06
<div class="angular-container" ng-controller="foodItemsCtrl">
<table class="table table-striped">
<tr>
<th>Name</th>
<th>Description</th>
<th>Starts At</th>
<th>Ends At</th>
<th>Price</th>
<th>Cooking Instructions</th>
'use strict';
var FoodItemService = function($http) {
return {
get : function() {
return $http.get('/api/food_item_templates');
},
test : function() {
...
public function add_ingredient()
{
if (Session::token() !== Input::get('_token'))
{
return Response::json(array(
'msg' => 'Unauthorized attempt to create option'
));