Skip to content

Instantly share code, notes, and snippets.

View erikfrerejean's full-sized avatar
:octocat:

Erik Frèrejean erikfrerejean

:octocat:
View GitHub Profile
#!/bin/bash
# Add Vagrant's NFS setup commands to sudoers, for `vagrant up` without a password
# Updated to work with Vagrant 1.3.x
# Stage updated sudoers in a temporary file for syntax checking
TMP=$(mktemp -t vagrant_sudoers)
cat /etc/sudoers > $TMP
cat >> $TMP <<EOF
# Allow passwordless startup of Vagrant when using NFS.
@erikfrerejean
erikfrerejean / block_plugin.info
Created March 12, 2015 07:34
Drupal blocks exposed as CTools plugins. This is just a quick POC for some internal debate, by far not the best implementation but you'll get the idea ;).
name = block_plugin
core = 7.x
dependencies[] = ctools
@erikfrerejean
erikfrerejean / SassMeister-input.scss
Created December 31, 2014 07:37
Generated by SassMeister.com.
// ----
// Sass (v3.4.9)
// Compass (v1.0.1)
// ----
/**
* "Extend" using mixin
*/
@mixin clearfix() {
&:before,
@erikfrerejean
erikfrerejean / CreateDocx.inc
Created September 19, 2014 13:38
This `file_exists` check can never pass as the file is located back in `../Transform/TransformDocAdv.inc`
public function transformDocument($docSource, $docDestination, $tempDir = null, $options = array(), $version = null)
{
if (file_exists(dirname(__FILE__) . '/TransformDocAdv.inc')) {
<?php
$array = array(
'145' => 4,
'213' => 99,
'etc' => 'etc',
);
var_dump(isset($array['145'])); // Returns FALSE
var_dump(array_key_exists(145, $array)); // Returns FALSE
$process->setCommandLine(str_replace('\'&&\'', '&&', $process->getCommandline()));
@erikfrerejean
erikfrerejean / gist:11217941
Last active August 29, 2015 14:00
quick select
jQuery('input[type="checkbox"]').each(function(index, elem) { jQuery(elem).prop('checked', 'checked'); });
@erikfrerejean
erikfrerejean / ord-helper.php
Created August 2, 2013 07:28
utf8 sort of ord replacement :).
<?php
function blgg_ord_helper($string) {
mb_internal_encoding("UTF-8");
$char = mb_substr($string, 0, 1);
return hexdec(bin2hex($char));
}
<?php
/**
* Class voor de communicatie met api.postcodeapi.nu
*/
class PostcodeAPI {
/**
* @var String API URI
*/
const API_URI = 'http://api.postcodeapi.nu';