Skip to content

Instantly share code, notes, and snippets.

View robdecker's full-sized avatar

Rob Decker robdecker

View GitHub Profile
function getParameterByName(name) {
name = name.replace(/[\[]/, "\\[").replace(/[\]]/, "\\]");
var regex = new RegExp("[\\?&]" + name + "=([^&#]*)"),
results = regex.exec(location.search);
return results === null ? "" : decodeURIComponent(results[1].replace(/\+/g, " "));
}
@robdecker
robdecker / gulpfile.js
Created February 9, 2016 23:54
Sample Gulp setup
'use strict';
// Include Gulp
var gulp = require('gulp'),
// Include Plug-ins
changed = require('gulp-changed'),
globbing = require('gulp-css-globbing'),
imagemin = require('gulp-imagemin'),
jshint = require('gulp-jshint'),

Keybase proof

I hereby claim:

  • I am robdecker on github.
  • I am robdecker (https://keybase.io/robdecker) on keybase.
  • I have a public key whose fingerprint is F497 BEBA 2C24 EC12 BD37 3D7E 9AA2 7C02 B6C0 CDD1

To claim this, I am signing this object:

@robdecker
robdecker / log-today.applescript
Last active October 26, 2016 21:15
Applescript to act as a middleman between Tyme2 and Bala's TW logger. Place into same directory as Bala's "log" script. To run: "$ osascript log-today.applescript"
global _filename
on run
tell application "Finder"
-- Get this script's parent directory
set _path to (container of (path to me)) as text
set _filename to _path & "todays-log.csv"
-- Convert the filename to "/path/to/file" format
set _filename to POSIX path of _filename
end tell
@robdecker
robdecker / .scss
Last active November 2, 2019 01:41
[Bootstrap grid, using Susy & include-media] #bootstrap #sass
@import "susy";
@import "include-media";
$susy-columns: 12;
$susy-gutter-width: 15px;
$susy: (
columns: $susy-columns,
gutter-position: inside-static, // fixed-width width gutters
column-width: 120px,
@robdecker
robdecker / how-to-get-youtube-video-id.md
Last active March 30, 2021 22:14 — forked from jakebellacera/how-to-get-youtube-video-id.md
[Learn how to get the ID of any YouTube video] #video #youtube

How to get the ID of any YouTube Video

This article walks you through how to get the ID of any YouTube video.

How to get a YouTube video ID from a youtube.com page URL

You may be watching the video or just happened to visit a link to a video. The video ID will be located in the URL of the video page, right after the v= URL parameter.

@robdecker
robdecker / snippet.twig
Last active October 18, 2019 19:13
[Get all variables in twig template] #d8 #twig
<pre>{{ dump() }}</pre>
{{ dump(_context|keys) }}
<ol>
{% for key, value in _context %}
<li>{{ key }}</li>
{% endfor %}
</ol>
$bundle_label = \Drupal::entityTypeManager()
->getStorage('node_type')
->load($node->bundle())
->label();
@robdecker
robdecker / Breadcrumbs.php
Last active October 17, 2019 19:49 — forked from jonpugh/Breadcrumbs.php
[Add Taxonomy Term to a Node's Breadcrumb in Drupal 8] #d8
<?php
// src/Breadcrumbs.php
namespace Drupal\modulename;
use Drupal\Core\Breadcrumb\BreadcrumbBuilderInterface;
use Drupal\Core\Routing\RouteMatchInterface;
use Drupal\Core\Breadcrumb\Breadcrumb;
use Drupal\Core\Link;