Skip to content

Instantly share code, notes, and snippets.

View emjayess's full-sized avatar
💭
🪞 mirroring repos from gitlab

Matthew J. Sorenson emjayess

💭
🪞 mirroring repos from gitlab
View GitHub Profile
@emjayess
emjayess / contrib.drush.inc
Created August 15, 2012 21:50
capture, disable, and re-enable the currently enabled contrib modules in a drupal site
drush pml --no-core --type=module --status=enabled --pipe > contrib.modules.txt
# then
drush -y dis `cat contrib.modules.txt`
# later
drush -y en `cat contrib.modules.txt`
@emjayess
emjayess / seekParagraphs.js
Created September 13, 2012 22:45
finds <p>'s within a given context of a web page
(function(){
var context = arguments[0] || document.body
, pNodes = [], txtNodes = []
, ELM_NODE = 1, TXT_NODE = 3//, HTML_COMMENT_NODE = 8
, whitespace = /^\s*$/;
// more useful!
function seekParaNodes(ctx) {
if (ctx.nodeType == ELM_NODE && ctx.nodeName == 'P') {
pNodes.push(ctx); //console.log(ctx.textContent);
@emjayess
emjayess / percona-wizard-macaroni-mysql.cnf
Created September 17, 2012 17:31
sample mysql config via the percona configuration wizard
# Generated by Percona Configuration Wizard (http://tools.percona.com/) version REL5-20120208
[mysql]
# CLIENT #
port = 3306
socket = /usr/local/mysql/data/mysql.sock
[mysqld]
@emjayess
emjayess / template.php
Created September 18, 2012 15:27
[re]define preprocess hooks for theming individual views, displays, fields, rows, etc...
// somewhere in themes/best_theme_ever/template.php
/**
* Implements hook_preprocess_views_view
*/
function bte_preprocess_views_view(&$vars) {
if (isset($vars['view']->name)) {
$view_preproc_by_name = 'bte_preprocess_views_view__'.$vars['view']->name;
//
if (function_exists($view_preproc_by_name)) {
@emjayess
emjayess / git-help-stash.recovering-stashes.md
Created September 28, 2012 19:48
Recovering stashes that were cleared/dropped erroneously

Recovering stashes that were cleared/dropped erroneously

If you mistakenly drop or clear stashes, they cannot be recovered through the normal safety mechanisms. However, you can try the following incantation to get a list of stashes that are still in your repository, but not reachable any more:

git fsck --unreachable | grep commit | cut -d\  -f3 | xargs git log --merges --no-walk --grep=WIP
@emjayess
emjayess / alert.md
Created October 2, 2012 15:54
App Engine Symlink Status

App Engine Symlink Status

Symbolic links in /usr/local/bin have been created for the following commands:

api_server.py
appcfg.py
bulkload_client.py
bulkloader.py
dev_appserver.py
download_appstats.py
gen_protorpc.py

@emjayess
emjayess / 1.0-resource.inc
Created October 5, 2012 21:19
Testing ways to fork code [drupal] paths for api versioning, in which supporting code files live in subfolders
<?php
// resource.inc in api_forker/1.0/
/**
* api forker callbacks for the beta version of the api
*/
function api_forker_callback($api_version, $api_resource) {
$debug = '<pre>generated at line: ' . __LINE__ . ' in ' . __FILE__ . '</pre>';
return "<p>Thanks for using Api Version <strong>$api_version!</strong></p> $debug";
@emjayess
emjayess / async-css.js
Created October 10, 2012 21:49
simple async loading patterns
// load a style
;(function(d) {
var lnk = d.createElement('link'), h = d.getElementsByTagName('head')[0];
lnk.href = 'css.css';
lnk.type = 'text/css';
lnk.rel = 'stylesheet';
h.appendChild(lnk);
}​(document))​​​​;
@emjayess
emjayess / cert-instructions
Created November 20, 2012 05:51
Generate a StartCom Ltd Authorized unified ssl certificate for use in nginx
# Decrypt the private key by using the password you entered when you created your key:
openssl rsa -in ssl.key -out /etc/ssl/private/ssl.key
# Protect your key from prying eyes:
chmod 600 /etc/ssl/private/ssl.key
# Fetch the Root CA and Class 2 Intermediate Server CA certificates:
wget http://www.startssl.com/certs/ca.pem
wget http://www.startssl.com/certs/sub.class2.server.ca.pem
@emjayess
emjayess / goog-query-args
Created November 30, 2012 05:33
google search's query string args
https://www.google.com/webhp
?sourceid=chrome-instant
&ion=1
&ie=UTF-8#hl=en
&safe=off
&tbo=d
&sclient=psy-ab
&q=here%20lies%20a%20fucking%20search%20query
&oq=
&gs_l=