Skip to content

Instantly share code, notes, and snippets.

View oliverlundquist's full-sized avatar

Oliver Lundquist oliverlundquist

View GitHub Profile
gulp.task('phplint', function () {
exec('find . -type f -name "*.php" | xargs -n 1 php -d display_errors=1 -l | grep -v "No syntax errors"', function(error, stdout) {
console.log(stdout);
});
});
tag_my_repo() {
find ~/repositories/oliverlundquist/repotest -type d -maxdepth 1 -mindepth 1 |
xargs -I '{}' bash -c '
PATH="$1"
VERSION="$2"
cd $PATH
git pull
@oliverlundquist
oliverlundquist / transactions.php
Created July 28, 2015 15:06
sql transactions
public function handle()
{
for($i=1; $i<=100; $i++) {
if ($i===1) {
\DB::table('transactions')->insert(['colorme_id' => $i]);
} else {
\DB::statement('insert into transactions(colorme_id) SELECT MAX(colorme_id)+1 from transactions');
}
usleep(200000);
}
require 'rubygems'
require 'bundler/setup'
require 'uri'
require 'rest-client'
require 'json'
username = ''
password = ''
origin = "https://#{username}:#{password}@api.github.com/repos/kurashicom/cart/labels"
destination = "https://#{username}:#{password}@api.github.com/repos/kurashicom/evaluation/labels"
@oliverlundquist
oliverlundquist / gist:bd1a26d091c17796b557
Created September 25, 2015 03:17
Active Global Scope Query Laravel
<?php namespace App;
use Illuminate\Database\Eloquent\ScopeInterface;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\Model;
class ActiveScope implements ScopeInterface
{
/**
* Apply the scope to a given Eloquent query builder.
<?php
trait MetaProperties {
public $limit = 0;
public function setLimit($limit) {
$this->limit = $limit <= $this->maxCount ? $limit : $this->maxCount;
}
public function getLimit() {
return $this->limit;
<?php
trait MetaProperties {
public function getLimit() {
return $this->limit;
}
public function setLimit($limit) {
$this->limit = $limit <= $this->maxLimit ? $limit : $this->maxLimit;
}
}
<?php
class SymfonyFile extends SplFileInfo
{
public function __construct($path, $originalName, $mimeType = null, $size = null) {
parent::__construct($path);
}
}
class FileHandler
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Graph 1</title>
<style>
body {
background-color:#eee;
text-align:center;
}
@oliverlundquist
oliverlundquist / gist:bf345ef3eb06bd02cb0d
Created October 29, 2015 06:00
sublime user settings
{
"color_scheme": "Packages/Colorsublime - Themes/Github.tmTheme",
"draw_white_space": "all",
"ensure_newline_at_eof_on_save": true,
"font_size": 13,
"ignored_packages":
[
"Vintage"
],
"trim_automatic_white_space": false,