Skip to content

Instantly share code, notes, and snippets.

View edwinheij's full-sized avatar
😊
Keep smiling

Edwin Heij edwinheij

😊
Keep smiling
View GitHub Profile
<?php
$peoples = array(
array("name" => "jeffrey", "age" => 28),
array("name" => "john", "age" => 20)
);
// the common way
function array_pluck($toPluck, $arr) {
$ret = array();
foreach($arr as $item) {
sudo apt-get update
sudo debconf-set-selections <<< 'mysql-server mysql-server/root_password password root'
sudo debconf-set-selections <<< 'mysql-server mysql-server/root_password_again password root'
sudo apt-get install -y vim curl python-software-properties
sudo add-apt-repository -y ppa:ondrej/php5
sudo apt-get update
sudo apt-get install -y php5 apache2 libapache2-mod-php5 php5-curl php5-gd php5-mcrypt php5-readline mysql-server-5.5 php5-mysql git-core php5-xdebug
@edwinheij
edwinheij / gist:804e9f145c8bf4545e2c
Created September 5, 2014 08:53
No HyperVisor voor Windows 8.1
C:\>bcdedit /copy {current} /d "No Hyper-V"
The entry was successfully copied to {ff-23-113-824e-5c5144ea}.
C:\>bcdedit /set {ff-23-113-824e-5c5144ea} hypervisorlaunchtype off
The operation completed successfully.
Afsluiten met shift ingedrukt. Other OS. Dan 'No Hyper-V' kiezen.
@edwinheij
edwinheij / gist:cd5925b179389f7be923
Created September 11, 2014 11:02
generate ctags file
ctags -R --exclude=.git --exclude=log *
@edwinheij
edwinheij / gist:d208ce97e1dcf6f9765c
Last active August 29, 2015 14:06
datum en tijd omzetten naar welk formaat dan ook
<?php
if ( ! function_exists('refdate'))
{
/**
* $datum datum in wat dan ook voor formaat (ook unix)
* $outputformat d-m-Y / y-m-d / ... of unix / mysql
* result datum in gewenste formaat
* anders 'Error' en error message in log-file
*
* Gebruik met uitkomsten
@edwinheij
edwinheij / gist:508fbb749b91612f8f0f
Last active February 17, 2017 19:45
Eloquent query logging
<?php
// edit app/config/local/database.php -> 'log' => true
// @ http://stackoverflow.com/questions/19131731/laravel-4-logging-sql-queries
if (Config::get('database.log', false)) {
Event::listen('illuminate.query', function($query, $bindings, $time, $name) {
$data = compact('bindings', 'time', 'name');
// Format binding data for sql insertion
foreach ($bindings as $i => $binding) {
@edwinheij
edwinheij / routes.php
Created December 1, 2014 15:06
Levenshtein
<?php
Route::get('lev', function()
{
$a = [ 'Rotterdam', 'Capelle a/d IJssel', 'Nieuwerkerk a/d IJssel', 'Maassluis', 'Schiedam', '\'s Gravenhage', 'Vlaardingen'];
// $b = 'niewekek IJssel'; // match
// $b = 'niewkek IJssel'; // geen match
// $b = 'Capelle a/d IJssel'; // match
// $b = 'capelle ijssel'; // match
// $b = 'gravenh'; // geen match
@edwinheij
edwinheij / gist:8c7272427be33ea49585
Last active August 29, 2015 14:13
Ubuntu webserver installation
#!bash/sh
sudo apt-get install apache2 -y
sudo apt-get install mysql-server -y
sudo apt-get install php5 libapache2-mod-php5 php5-mcrypt php5-curl -y
sudo php5enmod mcrypt
sudo /etc/init.d/apache2 restart
sudo apt-get install git-core -y
sudo apt-get install curl wget -y
curl –sS https://getcomposer.org/installer | php
sudo mv composer.phar /usr/bin/composer
<?php
use Illuminate\Console\Command;
use Illuminate\Filesystem\Filesystem;
class ViewsCommand extends Command {
/**
* The console command name.
*
* @var string
@edwinheij
edwinheij / 0_reuse_code.js
Last active August 29, 2015 14:17
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console