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 / gist:1284774
Created October 13, 2011 16:52
anonymous function using arguments with parent fn's variables
public function parentFn($argVar) {
$decVar = 0.00;
$callback = function ($anonVar) use ($argVar, &$decVar) {
$result += ($decVar * $anonVar) * ($argVar);
};
return round($result, 2);
}
@emjayess
emjayess / spoken-reminder.crontab
Created February 14, 2012 14:24
"are you working on your most important item?"
MacBook-Pro:~ emjayess$ crontab -l
42 08-18 * * 1-6 osascript -e "beep 5"; say -v Victoria -r 200 are you working on your most important item?
// see also: multiple ways to make a mac go 'beep'...
// http://stackoverflow.com/questions/3127977/how-to-make-the-hardware-beep-sound-in-mac-os-x-10-6
@emjayess
emjayess / forfiles.bat
Created February 29, 2012 15:21
scan for files larger than given size on a windows drive
forfiles /P C:\path\to\files /M *.* /S /D +"01/01/2012" /C "cmd /c if @fsize gtr 200200200 echo @path @fsize @fdate @ftime"
@emjayess
emjayess / cache-fly.manifest
Created March 9, 2012 19:18
application caching on the fly
CACHE MANIFEST
# cache pages as they're visited
# display '/offline' when offline and hitting a page not yet cached...
FALLBACK:
/ /offline
NETWORK:
*
@emjayess
emjayess / the-anti-anchor.html
Created March 27, 2012 14:53
microsoft asp.net rage anti-pattern #743
<!-- what tha f*ck -->
<a id="ctl00_MasterBody_DownloadDetail_ctl02_DownloadFileLink" href="javascript:__doPostBack('ctl00$MasterBody$DownloadDetail$ctl02$DownloadFileLink','')">
@emjayess
emjayess / install-pear
Created July 11, 2012 19:43
install pear on os x lion, and drush via pear channel
### via http://blog.stealth35.com/2011/07/27/install-pear-on-osx-lion.html
# sudo cp /private/etc/php.ini.default /private/etc/php.ini
sudo php /usr/lib/php/install-pear-nozlib.phar
pear config-set php_ini /private/etc/php.ini
pecl config-set php_ini /private/etc/php.ini
sudo pear upgrade-all
# what about when using MAMP's php?
@emjayess
emjayess / amd-loading.js
Created July 17, 2012 19:13
alternative approaches / patterns to AMD-style module loading
/**
* AMD module loading patterns: 2 possible approaches
*/
define(['dojo/query', 'dojo/on'], function(query, on){
// my module code
});
// oft-favored for maintaining modules per line of code
define(function(require) {
@emjayess
emjayess / drupal_w1zk1d.sql
Created July 27, 2012 14:36
grant permissions to a user on multiple mysql databases
# grant the following perms to 'w1zk1d' on all localhost db's with a name prefix of 'drupal_' ...
GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, INDEX, ALTER, LOCK TABLES, CREATE TEMPORARY TABLES ON `drupal_%`.* TO 'w1zk1d'@'localhost' IDENTIFIED BY 'kick@ss';
@emjayess
emjayess / gist:3270360
Created August 6, 2012 04:22
nginx/1.2.1 (stable) installation configuration - precise pangolin
:~# nginx -V
nginx version: nginx/1.2.1
TLS SNI support enabled
configure arguments: --prefix=/etc/nginx --conf-path=/etc/nginx/nginx.conf --error-log-path=/var/log/nginx/error.log --http-client-body-temp-path=/var/lib/nginx/body --http-fastcgi-temp-path=/var/lib/nginx/fastcgi --http-log-path=/var/log/nginx/access.log --http-proxy-temp-path=/var/lib/nginx/proxy --http-scgi-temp-path=/var/lib/nginx/scgi --http-uwsgi-temp-path=/var/lib/nginx/uwsgi --lock-path=/var/lock/nginx.lock --pid-path=/var/run/nginx.pid --with-pcre-jit --with-debug --with-http_addition_module --with-http_dav_module --with-http_geoip_module --with-http_gzip_static_module --with-http_image_filter_module --with-http_realip_module --with-http_stub_status_module --with-http_ssl_module --with-http_sub_module --with-http_xslt_module --with-ipv6 --with-sha1=/usr/include/openssl --with-md5=/usr/include/openssl --with-mail --with-mail_ssl_module --add-module=/build/buildd/nginx-1.2.1/debian/modules/nginx-auth-pam --add-module=/build/buildd/nginx-1.
@emjayess
emjayess / pushkey.sh
Created August 10, 2012 16:20
push your public key to the authorized key file on your server
#!/bin/bash
# original source here: http://drupal.org/files/issues/pushkey.txt
#
# pushkey
#
# usage:
#
# pushkey [email protected]