Skip to content

Instantly share code, notes, and snippets.

View nckg's full-sized avatar

Nick Goris nckg

  • Pixeo
  • Belgium
View GitHub Profile
@nckg
nckg / osx_lion_rail_setup.md
Created March 27, 2012 14:27 — forked from jpantuso/osx_lion_rail_setup.md
Setup OS X 10.7 w/ homebrew, oh-my-zsh, rvm, rails, and MySQL
# Makes Sinatra support multiple view paths.
# Usage:
#
# class Main < Sinatra::Base
# register Sinatra::MultiView
#
# get '/' do
# locals = { :name => current_user.name }
#
# # Instead of `haml 'home', {}, locals`
@nckg
nckg / gist:3245722
Created August 3, 2012 08:15
Lambert-72 (EPSG:31370) definition for Proj4js
Proj4js.defs["EPSG:31370"] = "+proj=lcc +lat_1=51.16666723333333 +lat_2=49.8333339 +lat_0=90 +lon_0=4.367486666666666 +x_0=150000.013 +y_0=5400088.438 +ellps=intl +towgs84=106.869,-52.2978,103.724,-0.33657,0.456955,-1.84218,1 +units=m +no_defs";
@nckg
nckg / UpdateCSS.js
Created August 24, 2012 13:19 — forked from tmcls/UpdateCSS.js
Run this jQuery script to update your css. Be creative and create a bookmarklet from it ;-)
$("link[rel=stylesheet]").each(function(){
var url = $(this).attr('href');
url = url.replace(/\?tcnc=\d+/,'').replace(/\&tcnc=\d+/,'');
url += (url.indexOf('?')>0 ? '&' : '?') + 'tcnc=' + (new Date()).getTime();
$(this).attr('href', url);
console.log('[UPDATED CSS] '+ url);
});
@nckg
nckg / import.php
Created September 28, 2012 12:00
Creates a SQL file with a simple sql `insert` statement from a .csv
#!/usr/bin/env php
<?php
setlocale(LC_ALL, 'nl_BE.UTF8');
$handle = fopen("test.csv", "r");
while (($data = fgetcsv($handle, 1000, ";")) !== FALSE) {
array_pop($data);
array_walk($data, 'wrapItem');
$sql[] = 'INSERT INTO src_leaseplandb VALUES (' . implode(', ', $data) . ');';
@nckg
nckg / takeAtLeast.js
Last active August 11, 2017 09:01
Extends Promise with a new property. Tells the Promise to take at least a minimum of given time before returning it
/**
* Extends Promise with a new property. Tells the Promise to take at least a minimum of given time.
*
* https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise/prototype
*
* Example:
*
* var p = new Promise(function (resolve, reject) { ... });
* p.takeAtLeast(1000).then(function () { ... });
*/
@nckg
nckg / InputEdit.vue
Created June 13, 2017 14:00
Vue Inline edit
<template>
<div>
<span v-show="!editing"
@click="toggleEdit" v-html="showValue"></span>
<div v-show="editing" class="row">
<div class="col-md-10">
<div class="form-group">
<textarea class="form-control"
rows="3"
@nckg
nckg / valet.conf
Created May 31, 2018 12:40 — forked from poul-kg/valet.conf
CORS Rules for Laravel Valet Nginx
# To enable CORS you should add lines with CORS rules below to your valet.conf file
# Find the file /usr/local/etc/nginx/valet/valet.conf - this is Valet conf for Nginx
# of try to execute `locate valet.conf` and find the `valet.coinf` in `nginx` subdirectory
# after you edit your valet.conf do not forget to execute `valet restart`
server {
listen 80 default_server;
root /;
charset utf-8;
client_max_body_size 128M;
@nckg
nckg / gist:1da0f34d1ead72c02323585509b5c2bb
Last active March 29, 2024 10:14
Setup raspberry Pi 3 (ubuntu server, php7.2, nginx) with Terraform
# https://jtway.co/ubuntu-server-16-06-on-raspberry-pi-3-via-terraform-93dccaef5ddb?gi=e5fcb8404a4d
variable "server_ip" {
default = "SERVER IP ADDRESS"
}
# Terraform documentation
# * Provisioner null_resource: https://www.terraform.io/docs/provisioners/null_resource.html
# * Provisioner Connections: https://www.terraform.io/docs/provisioners/null_resource.html