Skip to content

Instantly share code, notes, and snippets.

View slucero's full-sized avatar

Stephen Lucero slucero

  • Red Hat
  • Arkansas
View GitHub Profile
@slucero
slucero / gist:3869470
Created October 11, 2012 00:47
Alfred Extension: Tabbed Adium Chat
on alfred_script(q)
set theString to "" & q
set theMessage to theString
#get the name portion of the string
set AppleScript's text item delimiters to {":"}
set chatParts to (every text item in theString) as list
set theName to item 1 of chatParts
@slucero
slucero / 0_reuse_code.js
Created January 31, 2014 15:41
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@slucero
slucero / gist:cee51deacb4077a79f8e
Created August 29, 2014 15:50
Drupal EntityFieldQuery Example
<?php
$query = new EntityFieldQuery();
$entities = $query->entityCondition('entity_type', 'node')
->entityCondition('bundle', 'event')
->propertyCondition('status', 1)
->fieldCondition('field_date', 'value', array('2011-03-01', '2011-03-31'), 'BETWEEN')
->fieldOrderBy('field_date', 'value', 'ASC')
->execute();
$nodes = node_load_multiple(array_keys($entities['node']));
@slucero
slucero / gist:dbadd483ac09fe1bbe9d
Created September 9, 2014 20:57
Angular Compile Content Directive
/**
* Directive for compiling HTML loaded on-the-fly.
*
* Compiles the assigned scope attribute and inserts it inside the current element.
*
* Usage: Assign scope value name containing content to be compiled and inserted
* to compile-content attribute.
*
* Example: <div compile-content="htmlContent"></div>
* This assumes that $scope.htmlContent contains a sanitized HTML string.
@slucero
slucero / issue_numbers.rb
Created November 5, 2015 20:10
A Git hook for prepending commit messages with an issue number found in the current working branch. It's organized for use with the https://github.com/icefox/git-hooks project for managing git hooks.
#! /usr/bin/env ruby
# ~/.git_hooks/lib/issue_numbers.rb
$issue_pattern = /\d{5}(?=-)/
#require 'git'
#g = Git.open(working_dir, :log => Logger.new(STDOUT))
@slucero
slucero / git-track-all
Created December 8, 2015 19:06
Git command script to locally track all remote branches
#!/usr/bin/env ruby
##############################
# Create local tracking branches for all remote branches
# that don't have local branches with a matching name.
#
# TODO: Add remote name as an agument
# TODO: Add option for pass-through grep arguments to filter branches
##############################
@slucero
slucero / git-merge-all
Created December 8, 2015 19:11
Git command script to merge a single branch into multiple others.
#!/bin/bash
##############################
# Merge the current branch into multiple other local branches.
#
# TODO: Add the option to pass additional arguments to merge commands
##############################
# Determine the current branch name
source=$(git symbolic-ref HEAD 2> /dev/null) || source=$(git rev-parse --short HEAD 2> /dev/null);
@slucero
slucero / Vagrantfile
Last active January 25, 2018 22:55
Local Vagrant Configuration
# ~/.vagrant.d/Vagrantfile
# Local configuration to use across all Vagrant machines
Vagrant.configure("2") do |config|
config.vm.provider :virtualbox do |vb|
host = RbConfig::CONFIG['host_os']
# Force settings for allowed resources
if host =~ /darwin/
@slucero
slucero / README.md
Last active September 29, 2016 18:11
Create New Github PR

Add the git-pr file into as an executable in your local PATH. For example, if ~/bin is in your PATH, then the following should work:

# Add and save script content.
vi ~/bin/git-pr
# Make the script executable.
chmod u+x ~/bin/git-pr
@slucero
slucero / BlockContentPlacementSubscriber.php
Created May 22, 2017 19:24
YAML Content - Block Placement Event Subscriber
<?php
namespace Drupal\yaml_content\EventSubscriber;
use Drupal\block\Entity\Block;
use Drupal\block_content\Entity\BlockContent;
use Drupal\Core\Config\ConfigFactoryInterface;
use Drupal\Core\Entity\EntityStorageException;
use Drupal\yaml_content\Event\EntityPostSaveEvent;
use Drupal\yaml_content\Event\YamlContentEvents;