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 / hello_world.css
Created February 27, 2013 21:44
hello world drupal module exercise
body.node-type-article .field-name-body p:first-child:before {
content: "Content starts here! ";
font-style: italic;
display: block;
}
body.node-type-article #content:after {
content: "Hello World!";
font-weight: bold;
font-size: 150%;
@emjayess
emjayess / commerce-product-display.export.rule
Created December 20, 2012 15:06
A drupal 7 workflow rule for drupal commerce that auto-generates 1 new "product display" node (of type "my_product_display") for each newly created product entity; the 'data_set' action establishes a reference from the auto-generated display to the created product.
{ "rules_auto_create_product_display" : {
"LABEL" : "Auto-create product display",
"PLUGIN" : "reaction rule",
"REQUIRES" : [ "rules", "entity" ],
"ON" : [ "commerce_product_insert" ],
"IF" : [
{ "entity_has_field" : { "entity" : [ "commerce-product" ], "field" : "field_sku" } }
],
"DO" : [
{ "entity_create" : {
@emjayess
emjayess / memory_limit.php.ini
Created December 7, 2012 15:33
Set the default timezone and increase memory limit, Gangnam style!
u@s:/etc/php5/fpm$ cat php.ini | grep memory_limit
memory_limit = 1024M
@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=
@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 / 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 / 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 / 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 / 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 / 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)) {