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 / drupal-cache-tables
Last active August 29, 2015 14:05
MySQL statement to show tables with 'cache' in the table name
#mysql> show tables from `mydrupaldb` where `tables_in_mydrupaldb` like '%cache%';
mysql> show tables like '%cache%'; # this works, for just a single pattern match
+----------------------------------+
| Tables_in_mydrupaldb |
+----------------------------------+
| cache |
| cache_admin_menu |
| cache_apachesolr |
| cache_block |
| cache_bootstrap |
@emjayess
emjayess / davinci-cover-letter.md
Created November 24, 2014 05:54
Leonardo da Vinci's job application/appeal to Ludovico Sforza

The Skills of Leonard da Vinci

via Letters of Note

My Most Illustrious Lord,

Having now sufficiently seen and considered the achievements of all those who count themselves masters and artificers of instruments of war, and having noted that the invention and performance of the said instruments is in no way different from that in common usage, I shall endeavour, while intending no discredit to anyone else, to make myself understood to Your Excellency for the purpose of unfolding to you my secrets, and thereafter offering them at your complete disposal, and when the time is right bringing into effective operation all those things which are in part briefly listed below:

  1. I have plans for very light, strong and easily portable bridges with which to pursue and, on some occasions, flee the enemy, and others, sturdy and indestructible either by fire or in battle, easy and convenient to lift and place in position. Also means of burning and destroy
@emjayess
emjayess / 1.Enter-pyspark-shell
Last active August 29, 2015 14:14
Apache Spark & 'mcmath' NormTermOrder 10k
macarooni:geekout emjayess$ pyspark
Python 2.7.5 (default, Mar 9 2014, 22:15:05)
[GCC 4.2.1 Compatible Apple LLVM 5.0 (clang-500.0.68)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
Spark assembly has been built with Hive, including Datanucleus jars on classpath
Using Spark's default log4j profile: org/apache/spark/log4j-defaults.properties
15/02/03 09:18:31 INFO SecurityManager: Changing view acls to: emjayess
15/02/03 09:18:31 INFO SecurityManager: Changing modify acls to: emjayess
15/02/03 09:18:31 INFO SecurityManager: SecurityManager: authentication disabled; ui acls disabled; users with view permissions: Set(emjayess); users with modify permissions: Set(emjayess)
15/02/03 09:18:32 INFO Slf4jLogger: Slf4jLogger started
//artificially delay a javascript redirect w/anonymous function
//n represents delay in seconds
(function(){
var i,c=0,n=3;
i=window.setInterval(function(){
if(c++==n){
window.clearInterval(i);
top.location='http://redirect-here.tld/';
}
function $arr(xargs) {
return Array.prototype.slice.call(xargs);
}
//sample usage:
function someotherfn(arg1,arg2,arg3){
$args = $arr(arguments);
$args.sort();
}
@emjayess
emjayess / emstrong.css
Created November 1, 2010 17:59
this was an actual style rule on a site I inherited. :\
em {
font-weight: bold;
font-style: normal;
}
// Cross-browser object.watch and object.unwatch
// object.watch
if (!Object.prototype.watch) {
Object.prototype.watch = function (prop, handler) {
var oldval = this[prop], newval = oldval,
getter = function () {
return newval;
},
setter = function (val) {
@emjayess
emjayess / ternary.js
Created December 1, 2010 17:34
javascript's flexible ternary
// the agility of javascript's ternary operation...
// lots of folks don't seem aware of the subsequent assignments available
function ternary(a,b) {
var c,d,tis='';
c = (d = a==b) ? tis='tis true' : tis='tis false';
return [c,d,tis];
}
console.log(ternary(true,true));
console.log(ternary(true,false));
@emjayess
emjayess / mustache-cfc.test.cfm
Created December 28, 2010 23:25
this is going to make my life a little (ok, a lot) easier!...
<cfscript>
// require https://github.com/pmcelhaney/Mustache.cfc
mustache = createobject('component','cfc/mustache');//dump(mustache);
//view template:
hello_templ = '<h1>Hello, {{thing}}</h1>';
//model object:
hello_model = {
thing = 'Mustache'
/*!
* JavaScript whatevCache - v0.2pre - 12/30/2010
* http://benalman.com/
*
* Copyright (c) 2010 "Cowboy" Ben Alman
* Dual licensed under the MIT and GPL licenses.
* http://benalman.com/about/license/
*/
// whatevCache.set( key, value [, ttl ] );