Skip to content

Instantly share code, notes, and snippets.

View joelpittet's full-sized avatar

Joel Pittet joelpittet

View GitHub Profile
@mohanpedala
mohanpedala / bash_strict_mode.md
Last active May 6, 2024 07:25
set -e, -u, -o, -x pipefail explanation
@mortenson
mortenson / composer.json
Last active August 20, 2023 10:39
Example composer.json file for File Browser
{
"name": "mortenson/example",
"minimum-stability": "dev",
"authors": [
{
"name": "Samuel Mortenson",
"email": "samuel.mortenson@acquia.com"
}
],
"repositories": [
<?php
/**
* Recursively scans a directory and its subdirectories, to collect all files
* that end with the specified extension.
*
* The result is keyed by file basename.
*
* @param string $dir
* E.g. 'sites/all/modules'
-- 1. Create a new generic password entry in Keychain Access called "WHATEVER_AnyConnect_VPN" (the name in Keychain access must match that in line 39 below) with your password for the Cisco AnyConnect VPN server.
-- 2. Open this script in Script Editor (both this and the above are in the Applications->Utilities folder) and "Save as.." an Application (.app) with desired name.
-- 3. Open Security & Privacy System Preferences, go to Privacy, Accessibility.
-- 4. Enable the above .app so it can access Accessibility
-- 5. Copy and paste a nice icon on the generic Applescript icon (I used a copy of the default AnyConnect one)
-- 6. Add the new .app to /Users/[yourshortname]/Applications with a shortcut to your Dock
-- 7. Enjoy the fast connection with no need to enter password and increased security of not having a sensitive password stored as plain text
-- 8. Run script again to close connection
-- AnyConnect now refered to as targetApp
@joelpittet
joelpittet / ckeditor.config.js
Created June 4, 2015 22:44
CKEditor + Typekit (BESbswy Fix)
var typkitID = 'XXXXXXX';
CKEDITOR.on('instanceReady',
function(ev) {
var $editor_instance = CKEDITOR.instances[ev.editor.name];
(function(d) {
try {
var config = {
kitId: typkitID,
scriptTimeout: 3000
@crittermike
crittermike / gist:7b654d3d686a4e434eda
Created March 26, 2015 00:56
Run a single specific Drupal update hook using Drush
drush php-eval "module_load_install('MYMODULE'); MYMODULE_update_NUMBER();"
@joelpittet
joelpittet / index.php
Last active August 29, 2015 14:10
Twig Magic Attributes
<?php
// Setup Twig.
require_once 'vendor/autoload.php';
$loader = new Twig_Loader_String();
$twig_options = array(
'cache' => FALSE,
'autoescape' => TRUE,
'strict_variables' => FALSE,
'debug' => TRUE,
'auto_reload' => TRUE,
@star-szr
star-szr / services.yml
Last active August 29, 2015 13:59
Disable cache_render or other cache bins in Drupal 8
services:
cache.backend.memory:
class: Drupal\Core\Cache\MemoryBackendFactory
@star-szr
star-szr / xhprof-kit.sh
Last active February 7, 2016 14:16
xhprof-kit aliases and functions
# Creates a baseline from your current branch (should usually be 8.x).
alias bbranch='./xhprof-kit/benchmark-branch.sh `git rev-parse --abbrev-ref HEAD`'
# Using the baseline xhprof identifier from the bbranch command above will benchmark 8.x against the baseline and your patched branch.
# e.g.
# bbranches [XHPROF-IDENTIFIER] [twig-branch-name-here-1234456]
function bbranches() {
originalbranch="$(git rev-parse --abbrev-ref HEAD)"
base=$1
shift
@piscisaureus
piscisaureus / pr.md
Created August 13, 2012 16:12
Checkout github pull requests locally

Locate the section for your github remote in the .git/config file. It looks like this:

[remote "origin"]
	fetch = +refs/heads/*:refs/remotes/origin/*
	url = git@github.com:joyent/node.git

Now add the line fetch = +refs/pull/*/head:refs/remotes/origin/pr/* to this section. Obviously, change the github url to match your project's URL. It ends up looking like this: