This is just stuff that I have put down that I find I use a lot of the time for my own reference.
$ git pull
public static function insertOrUpdate($table, array $rows) | |
{ | |
$first = reset($rows); | |
$columns = implode(',', array_map(function($value) | |
{ | |
return "$value"; | |
}, array_keys($first))); | |
$values = implode(',', array_map(function($row) |
#!/bin/bash | |
if [ "$EUID" -ne 0 ] | |
then echo "Please run as root" | |
exit | |
fi | |
apt-get install pkg-config libmagickwand-dev -y | |
cd /tmp | |
wget https://pecl.php.net/get/imagick-3.4.0.tgz | |
tar xvzf imagick-3.4.0.tgz |
#Laravel 5 Simple ACL manager
Protect your routes with user roles. Simply add a 'role_id' to the User model, install the roles table and seed if you need some example roles to get going.
If the user has a 'Root' role, then they can perform any actions.
Simply copy the files across into the appropriate directories, and register the middleware in App\Http\Kernel.php
'use strict'; | |
// simple express server | |
var express = require('express'); | |
var app = express(); | |
var router = express.Router(); | |
app.use(express.static('public')); | |
app.get('/', function(req, res) { | |
res.sendfile('./public/index.html'); |
# less to scss based on http://stackoverflow.com/a/19167099/2363935 | |
namespace :convert do | |
task :less_to_scss do | |
source_glob = "assets/less/*.less" | |
dest_dir = "converted" | |
rm_r dest_dir rescue nil | |
mkdir_p(dest_dir) |
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>PHP INFO</title> | |
<style type="text/css"> | |
body {font-family: "Ubuntu Mono", "Monospace", "Monaco", "Courier New"; font-size: 12px} | |
</style> | |
<link rel="shortcut icon" href="favicon.png" type="image/x-icon" /> | |
</head> | |
<body> |
# Configuration file for runtime kernel parameters. | |
# See sysctl.conf(5) for more information. | |
# See also http://www.nateware.com/linux-network-tuning-for-2013.html for | |
# an explanation about some of these parameters, and instructions for | |
# a few other tweaks outside this file. | |
# | |
# See also: https://gist.github.com/kgriffs/4027835 | |
# | |
# Assumes a beefy machine with lots of network bandwidth |