Skip to content

Instantly share code, notes, and snippets.

View jstoone's full-sized avatar
🔥
Chameleon sports corvette with four buffalo-wing side door slide doors?

Jakob Steinn jstoone

🔥
Chameleon sports corvette with four buffalo-wing side door slide doors?
View GitHub Profile
@jstoone
jstoone / RouteInfo.php
Last active August 29, 2015 14:06
Laravel RouteInfo: A route controller and method helper class
<?php namespace JakobSteinn\Core;
use Illuminate\Routing\Router;
use Illuminate\Support\Str;
class RouteInfo {
/**
* @var Router
*/
@jstoone
jstoone / UniqueSlug.php
Created November 25, 2014 19:04
Laravel: Generate unique slug
/*
* Does not need to be wrapped in a class, I often have this in my model,
* but abstract when used more than once.
* @soruce: http://chrishayes.ca/blog/code/laravel-4-generating-unique-slugs-elegantly
*/
class UniqueSlug {
public static function generateUniqueSlug($value) {
$slug = Str::slug($value);
$slugs = static::whereRaw("slug REGEXP '^{$slug}(-[0-9]*)?$'");
@jstoone
jstoone / ptable.json
Last active August 29, 2015 14:11
Periodic Table Json
{
"ptable": {
"H": {
"group": 1,
"period": 1,
"atomNo": 1,
"name": "hydrogen",
"weight": 1.008,
"catagory": "other nonmetals",
"state": "gas",
@jstoone
jstoone / DatabaseSeeder.php
Last active August 29, 2015 14:17
Basic Laravel 5 Database Seeder
<?php
use Illuminate\Database\Seeder;
use Illuminate\Database\Eloquent\Model;
class DatabaseSeeder extends Seeder {
/**
* Tables that needs cleaning
*
@jstoone
jstoone / maxmind-geo-example.php
Last active August 29, 2015 14:21
Maxmind: Quick Geo Location
<?php
function getMaxmindCountry($ipaddress) {
$userid = '[user-id]';
$license_key = '[license-key]';
$query = 'https://geoip.maxmind.com/geoip/v2.0/country/' . $ipaddress;
if (empty($ipaddress)) {
return 'ERR';
}
@jstoone
jstoone / books.md
Last active August 29, 2015 14:28
Programming/PHP books

Booklist for @warkior

These are the books that I've read so far that I feel made the best impression on me, that is relevant to Laravel and PHP/Programming in general. Even though the two Laravel books are "dated" since they are for version 4.1 there are still a lot of things that can be learned from them.

"I found this book to be a great mix of solid advice and wonderful analogies!" --Martin Fowler, author of Refactoring and UML Distilled

@jstoone
jstoone / readme.md
Last active January 19, 2016 18:27
Laracon US 2016 Talk Description

Education, the basement edition

This talk is in fact not about being a home schooled individual, but rather about my jurney through the multiple steps of comming to terms and realizing the fact, that formal education is not a requirement set in stone, when wanting to work in the web development industry.

I will iterate through my process of persuing the educational path which I thought would be the only valid thing, allowing me to get a propper job as a web-developer.

Starting from a non-performant zombie-process hacking away at high-school education, later passing through an advertisment agency for a refreshing un-intentional reboot into a human equivalent of a multi-worker nginx daemon, I started realizing that I was on the right path. After a few work-load related crashes from imporper handling of requests, I learned how to handle and identify faulty or malicious requests and act accordingly.

Once I've entered the job market, the learning curves of new techonogies, proper handling of design patterns

{
"presets": ["es2015"],
"plugins": ["transform-runtime"]
}
@jstoone
jstoone / editor.vue
Created June 15, 2016 19:06
Quick & Dirty: Vue.js (vueify) wrapper for Ace editor
<template>
<!-- Languages -->
<div class="Editor__Languages">
<button @click.prevent="changeHighlight"
data-style="ace/mode/markdown"
class="btn btn-xs btn-primary">.md</button>
<button @click.prevent="changeHighlight"
data-style="ace/mode/php"
class="btn btn-xs">.php</button>
<button @click.prevent="changeHighlight"
@jstoone
jstoone / app.js
Created June 20, 2016 12:55
Spark + vue-router + vueify = awesome
require('./components/bootstrap');
import SparkWrapper from './lib/spark-wrapper';
import VueRouter from 'vue-router';
import HomeView from './pages/home/index.vue';
Vue.use(VueRouter);
const Router = new VueRouter();
Router.map({