Skip to content

Instantly share code, notes, and snippets.

View 1stevengrant's full-sized avatar
🏠
Working from home

Steven Grant 1stevengrant

🏠
Working from home
View GitHub Profile
<?php
namespace App\Http\Utilities;
class Country
{
protected static $countries = [
"United Kingdom" => "gb",
"United States" => "us",
"Canada" => "ca",
@1stevengrant
1stevengrant / states_hash.json
Created January 26, 2017 18:06 — forked from mshafrir/states_hash.json
US states in JSON form
{
"AL": "Alabama",
"AK": "Alaska",
"AS": "American Samoa",
"AZ": "Arizona",
"AR": "Arkansas",
"CA": "California",
"CO": "Colorado",
"CT": "Connecticut",
"DE": "Delaware",
@1stevengrant
1stevengrant / countries.json
Created January 26, 2017 17:59 — forked from keeguon/countries.json
A list of countries in JSON
[
{name: 'Afghanistan', code: 'AF'},
{name: 'Åland Islands', code: 'AX'},
{name: 'Albania', code: 'AL'},
{name: 'Algeria', code: 'DZ'},
{name: 'American Samoa', code: 'AS'},
{name: 'AndorrA', code: 'AD'},
{name: 'Angola', code: 'AO'},
{name: 'Anguilla', code: 'AI'},
{name: 'Antarctica', code: 'AQ'},
@1stevengrant
1stevengrant / haversine.php
Created January 24, 2017 08:49 — forked from fhferreira/haversine.php
Haversine Method for model Laravel.
<?php
/*
* find the n closest locations
* @param Model $query eloquent model
* @param float $lat latitude of the point of interest
* @param float $lng longitude of the point of interest
* @param float $max_distance distance in miles or km
* @param string $units miles or kilometers
* @param Array $fiels to return
* @return array
@1stevengrant
1stevengrant / elementapi.php
Last active December 28, 2016 19:14
API generation for jobs using elementapi for CraftCMS
<?php
namespace Craft;
return [
'endpoints' => [
'api/jobs.json' => [
'elementType' => 'Entry',
'criteria' => ['section' => 'jobs'],
'transformer' => function(EntryModel $entry) {
return [
@1stevengrant
1stevengrant / browserstack.test
Created November 30, 2016 14:19
set desktopBrowsers for testing in BrowserStack (we'll test our local Pattern Lab instance running on localhost:3000)
@@ table desktopBrowsers
| browser | gridArgs |
| Firefox | --dc.browser "Firefox" --dc.browser_version "46" --dc.os "WINDOWS" --dc.os_version "10" --dc.browserstack.local true |
var gulp = require('gulp');
var imagemin = require('gulp-imagemin');
gulp.task('img', function() {
return gulp.src('./assets/images/*')
.pipe(imagemin({ progressive: true }))
.pipe(gulp.dest('./assets/images'));
});
    /**
     * Display a listing of the resource.
     *
     * @return \Illuminate\Http\Response
     */
    public function index()
    {
        $posts = Post::paginate(20);
{% for history in order.histories %}
Status: '{{ history.newStatus }}' (previously '{{ history.prevStatus }}')
with message: '{{ history.message }}'<br>
{% endfor %}
@1stevengrant
1stevengrant / templates.js
Created May 3, 2016 13:26
Config for Wygwam templates
/*
Copyright (c) 2003-2014, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.md or http://ckeditor.com/license
*/
CKEDITOR.addTemplates("default", {
imagesPath: CKEDITOR.getUrl("/build/wygwam/"),
templates: [{
title: "Image on left with caption",
image: "img-left.png",
description: "Add an image on the left with caption",