Skip to content

Instantly share code, notes, and snippets.

View leantony's full-sized avatar
💭
I may be slow to respond.

leantony

💭
I may be slow to respond.
View GitHub Profile
@leantony
leantony / something.php
Last active September 7, 2018 10:47
try this one
// base class
abstract class AbstractSeeder extends Command
{
use TruncatesTables;
/**
* Create a new command instance.
*/
public function __construct()
{
@leantony
leantony / docker_laravel.sh
Created December 14, 2017 06:43
laradock and docker easy use script
#!/usr/bin/env bash
WORKING_DIR=$PWD/laradock
ENV_FILE=$PWD/.env
LARADOCK_URL=https://github.com/Laradock/laradock.git
# install any required dependencies
function install_deps(){
COMPOSER_COMMAND=`composer install`
NPM_COMMAND=`npm install`
@leantony
leantony / oauth2-springboot-mysql.sql
Created September 29, 2017 14:26
mysql tables for oauth2 spring
CREATE TABLE IF NOT EXISTS `oauth_access_token` (
`token_id` varchar(255) DEFAULT NULL,
`token` blob,
`authentication_id` varchar(255) DEFAULT NULL,
`user_name` varchar(255) DEFAULT NULL,
`client_id` varchar(255) DEFAULT NULL,
`authentication` blob,
`refresh_token` varchar(255) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
create table oauth_client_details (
client_id VARCHAR(255) PRIMARY KEY,
resource_ids VARCHAR(255),
client_secret VARCHAR(255),
scope VARCHAR(255),
authorized_grant_types VARCHAR(255),
web_server_redirect_uri VARCHAR(255),
authorities VARCHAR(255),
access_token_validity INTEGER,
refresh_token_validity INTEGER,
@leantony
leantony / gulpfile.js
Created July 17, 2016 19:17
sample gulpfile, with assets in vendor/bower
var elixir = require('laravel-elixir');
/*
|--------------------------------------------------------------------------
| Elixir Asset Management
|--------------------------------------------------------------------------
|
| Elixir provides a clean, fluent API for defining some basic Gulp tasks
| for your Laravel application. By default, we are compiling the Sass
| file for our application, as well as publishing vendor resources.
@leantony
leantony / array-sorting.php
Created June 9, 2016 15:27 — forked from MwirabuaTimothy/array-sorting.php
php - sorting an array of words by their relevance to a keyword
<?php
$query = 'ma';
$names = ['Kevin', 'Michael', 'Joseph', 'Mark', 'Edward', 'Velma', 'William', 'Mary', 'Kimani'];
// $target = ['Mark', 'Mary', 'Michael', 'Kimani', 'Velma', 'William', 'Edward', 'Joseph', 'Kevin'];
// $result = ['Mark', 'Mary', 'Kimani', 'Michael', 'Velma', 'William', 'Edward', 'Kevin', 'Joseph'];
// the slight difference is because the longer words have more irrelevant characters
function weights($query) { // return weight of letters determined by their order of appearance
$query = strtolower($query); // eliminate case sensitivity
#!/usr/bin/env bash
#set -x
# Shows you the largest objects in your repo's pack file.
# Written for osx.
#
# @see http://stubbisms.wordpress.com/2009/07/10/git-script-to-show-largest-pack-objects-and-trim-your-waist-line/
# @author Antony Stubbs

#STEP 1 Create a new laravel project. For more info, check the laravel docs page, on the laravel website

composer create-project laravel/laravel --prefer-dist my-laravel-app

#STEP 3 Install heroku toolbelt, on your machine. Assuming its ubuntu, just follow the following instructions Heroku toolbelt is a command line client, for heroku

<!DOCTYPE html>
<html>
<head>
<title>Simple Map</title>
<meta name="viewport" content="initial-scale=1.0">
<meta charset="utf-8">
<style>
html,
body {

FiniteAuditTrail Trait

Support for keeping an audit trail for any state machine, borrowed from the Ruby StateMachine audit trail gem. Having an audit trail gives you a complete history of the state changes in your model. This history allows you to investigate incidents or perform analytics, like: “How long does it take on average to go from state a to state b?”, or “What percentage of cases goes from state a to b via state c?”

Requirements

  1. PHP >= 5.4
  2. Laravel 4 framework