Skip to content

Instantly share code, notes, and snippets.

View kyletaylored's full-sized avatar
🍝
unfurling wet spaghetti

Kyle Taylor kyletaylored

🍝
unfurling wet spaghetti
View GitHub Profile
@kyletaylored
kyletaylored / Adobe Kuler Color & Drupal
Last active August 29, 2015 14:05
Adobe Kuler & Drupal: Color theme integration
<?php
// Add this to the bottom of color.inc.
// The color fields will differ on themes, so you'll need to make sure
// to update the field names for the colors.
// ie, brandprimary, brandsecondary, etc.
// Add Kuler colors
$kuler_json = theme_get_setting('kuler_json', variable_get('theme_default'));
$kuler_check = theme_get_setting('kuler_check', variable_get('theme_default'));
# Git branch in prompt.
parse_git_branch() {
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/'
}
parse_git_tag () {
git describe --tags 2> /dev/null
}
parse_git_branch_or_tag() {
local OUT="$(parse_git_branch)"
server {
listen 8080 default_server;
listen [::]:8080 default_server ipv6only=on;
root /var/www/html/drupal;
index index.php index.html index.htm;
error_page 404 /404.html;
error_page 500 502 503 504 /50x.html;
location = /50x.html {
@kyletaylored
kyletaylored / Drupal Bootstrap 2 Navigation Hack
Created January 30, 2015 01:49
Bootstrap 2 mobile navigation hack
Drupal.behaviors.themeMobileNavigation = {
attach: function(context, settings) {
// Menu
var header = $('#header', context);
header.once('menu', function(){
var menu = $('#menu', header);
var menuToggle = $('.mobile-menu a.toggle', header);
var ul = $('ul.menu.nav, .menu-block-wrapper > ul.menu', menu);
if (menu.length && menuToggle.length && ul.length) {
menuToggle.click(function(){
@kyletaylored
kyletaylored / Pivotal stories finished by user
Last active March 27, 2017 14:16
Show all accepted Pivotal Tracker stories for specific user
For example, Kyle Taylor (kt)
owner:kt AND state:accepted
@kyletaylored
kyletaylored / Mac Command Prompt
Created January 6, 2016 07:55
A better command prompt for Mac, including git status of current directory.
function directory_size () {
# Sum the number of bytes in a directory listing
size=$(ls -l | awk 'BEGIN {x=0} NR > 1 {x+=$5} END {
split("B KB MB GB TB PB",type);
if (x > 0) {
for(i=5;y < 1;i--) {
y = x / (2**(10*i));
}
}
printf "%.2f %s", y, type[i+2]
@kyletaylored
kyletaylored / Remove all git tags
Created July 11, 2016 20:08 — forked from okunishinishi/Remove all git tags
Delete all git remote tags
#Delete local tags.
git tag -l | xargs git tag -d
#Fetch remote tags.
git fetch
#Delete remote tags.
git tag -l | xargs -n 1 git push --delete origin
#Delete local tasg.
git tag -l | xargs git tag -d
@kyletaylored
kyletaylored / 1-extract-breakpoint.less
Last active August 24, 2016 15:13
Bootstrap 2 grid options (from Bootstrap 3)
// -----------------------------------------
// Bootstrap 2 related variables / functions
// -----------------------------------------
@mobile: ~"(max-width: 767px)";
@tablet: ~"(min-width: 768px) and (max-width: 979px)";
@normal: ~"(min-width: 980px) and (max-width: 1199px)";
@wide: ~"(min-width: 1200px)";
@gridColumns: 12;
@gridColumnWidth: 60px;
@kyletaylored
kyletaylored / image.html
Created November 16, 2016 21:00
Jekyll: HD images with Retina.js
{% comment %}
We're splitting off the file extension in order to add "@2x"
if the image is retina ready, else use a regular image with "data-no-retina".
Image extension is assumed 3 characters. PNG, JPG, GIF (no JPEG).
{% endcomment %}
{% capture img_length %}{{ include.src | size | minus:4 }}{% endcapture%}
{% assign img_ext = include.src | slice: -4,4 %}
{% assign img_name = include.src | slice: 0,img_length %}
@kyletaylored
kyletaylored / drupal-7-uninstall-module-checkboxes.js
Created January 20, 2017 20:17
A one-liner to run in your console when you need to uncheck many modules on the uninstall screen.
[...document.querySelectorAll(".form-type-checkbox input.form-checkbox:not([disabled])")].forEach(checkbox => checkbox.checked=true);