Skip to content

Instantly share code, notes, and snippets.

@dvessel
dvessel / oeadvscan
Last active January 12, 2021 17:49
Manage MAME files for OpenEmu Arcade core. Make it executable and unquarantine: `chmod +x oeadvscan && xattr -d com.apple.quarantine oeadvscan`
#!/bin/zsh
#
# For use on MAME files managed by OpenEmu.
# advscan roms/disks/samples verifies and repairs.
#
# All options apply to roms, disks (chd) and samples.
# Options:
#
# scan : Generates a report specific to your collection. (default)
@dvessel
dvessel / oemame.sh
Last active January 5, 2021 01:41
Shell functions for scanning/repairing MAME ROMs for OpenEmu on a Mac. Copy into your .zshrc file. Not tested on bash.
# advscan MAME roms/disks/samples scans and repairs.
function oemame.scan {
local command=${@:-scan}
local base_dir=$HOME/Library/Application\ Support/OpenEmu
local version=${${${:-`defaults read \
$base_dir/Cores/MAME.oecoreplugin/Contents/Info.plist CFBundleVersion`
}/./}%%.*}
# Go back to current directory when done.
# advscan can't resolve paths when run outside advscan.rc.
@dvessel
dvessel / oeshader.sh
Created January 1, 2021 18:27
Shell functions to manage OpenEmu shaders. Copy into your .zshrc file. Requires fzf. Not tested in bash.
# OpenEmu shader functions. Requires fzf.
function oeshader.search {
defaults find videoShader.openemu | grep $@
}
function oeshader.copy {
local source=`oeshader.ls ${@:-1} | fzf --header="Select source:"`
if [[ -n $source ]]; then
oeshader.search -oE "system\.[a-z0-9]*" | sort -u |
fzf -m --header="Apply settings from \"${source##*.}\"." |
@dvessel
dvessel / Share Screen Shot.scpt
Last active August 29, 2015 13:59
AppleScript to capture screen shots and upload them with SCP.
-- Requires public key encryption setup for the remote server.
-- This also assumes LaunchBar is installed.
property the_url : "http://example.com/path/"
property save_folder : "/Users/bob/Sites/example.com/path/"
property scp_remote : "[email protected]:/www/example.com/path/"
on run
set tmp_name to do shell script "date +'%Y-%m%d-%H%M%S'" & ".png"
@dvessel
dvessel / base-debug.css
Last active December 20, 2015 01:19
Ensure component modifiers have a set base. @extend in Sass can get out of hand. Manually setting both base and modifiers can trim down the compiled styles.
// Find modifer without base.
// .[base--]modifier - yes
// .[base-s]ubelement - no
// .foo-[base--]modifier - no
// .bar[base--]modifier - uhh.. Just name your classes correctly.
[class*="base--"]:not([class*="-base--"]) {
outline: 2px solid red;
}
// Base exists, cancel.
[class*="base--"]:not([class*="-base--"]).base {
@dvessel
dvessel / template.php
Last active March 11, 2021 21:43
Drupal theme registry alterations to allow theme functions, preprocess/process function to be organized like templates (.tpl.php).
<?php
/**
* Theme templates, functions and preprocess/process functions
*
* Theme templates `*.tpl.php` files are stored in the `theme` directory along
* with `*.func.php` and `*.vars.php` files. The latter two are enabled by the
* processing done below. The three types of files can be grouped into
* sub-directories. It is recommended that they are grouped by the modules
* they originate from. Theme specific hooks should be grouped into a folder
@dvessel
dvessel / .bash_profile
Last active December 18, 2015 05:48
A few of my dot files.
# Styles @see man terminfo
__blu=`tput setaf 25` # blue
__gra=`tput setaf 245` # gray
__ora=`tput setaf 208` # orange
__end=`tput setaf 0` # end colors
__bol=`tput bold` # bold
__res=`tput sgr0` # reset
# /usr/local/* defined so it comes before /usr/bin and /bin. Required for
# Homebrew. Default PATH=/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin
@dvessel
dvessel / gist:5406410
Created April 17, 2013 18:01
AppleScript I use with LaunchBar to upload screenshots to dropbox. tmp folder automatically cleans itself out every month through Hazel.
--Two changes to be made before you use this script
--1. Find this line in the script below and change it to the path to your Dropbox Public folder.
--Change pubfolder to the path of your dropbox public folder (ex. /Users/John/Dropbox/Public/)
--2. Observe one of your Dropbox URLs and you will notice that there are some numbers in those URLs. That is your Dropbox id.
--Find this line in the script below and change it to your Dropbox id instead of 123456
--set dropboxID to 123456
-------------------------------------------------------------------
--How to use?
--Bring this script in LaunchBar, press space and type the name that you would like to give to that screenshot and press return
--e.g. myname
@dvessel
dvessel / gist:5312604
Created April 4, 2013 18:01
Get all node types and information on their fields.
<?php
foreach (array_keys(field_info_instances('node')) as $node_type) {
$fields_info = field_info_instances('node', $node_type);
print $node_type . '</br>';
foreach ($fields_info as $field_name => $value) {
$field_info = field_info_field($field_name);
$field_name = $field_info['field_name'];
$type = $field_info['type'];
$module = $field_info['module'];
@dvessel
dvessel / pr.md
Created March 26, 2013 00:17 — forked from piscisaureus/pr.md

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 = [email protected]: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: