Skip to content

Instantly share code, notes, and snippets.

View seagoj's full-sized avatar

Jeremy Seago seagoj

View GitHub Profile
@seagoj
seagoj / devtools.js
Last active December 26, 2015 06:49
Jquery slideshow functions
var merge = function(obj1, obj2) {
var ret = obj1;
for(index in obj2) {
ret[index] = obj2[index];
}
return ret;
};
@seagoj
seagoj / CapsToWIn.reg
Created November 20, 2013 22:44
Map Caps Lock to WIn key
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Keyboard Layout]
"Scancode Map"=hex:00,00,00,00,00,00,00,00,02,00,00,00,5c,e0,3a,00,00,00,00,00
" copy all this into a vim buffer, save it, then...
" source the file by typing :so %
" Now the vim buffer acts like a specialized application for mastering vim
" There are two queues, Study and Known. Depending how confident you feel
" about the item you are currently learning, you can move it down several
" positions, all the way to the end of the Study queue, or to the Known
" queue.
" type ,, (that's comma comma)
@seagoj
seagoj / mysql_db_compare.sql
Last active January 4, 2016 15:19
Compare two MySQL DB Schemas
SET @source_db = 'db1';
SET @target_db = 'db2';
SELECT
'Only in source' exist_type,
c1.table_schema, c1.table_name, c1.column_name, c1.ordinal_position, c1.column_default, c1.is_nullable, c1.numeric_precision, c1.numeric_scale, c1.character_set_name, c1.collation_name, c1.column_type, c1.column_key, c1.extra, c1.column_comment
FROM
(SELECT * FROM information_schema.columns WHERE TABLE_SCHEMA = @source_db) c1
LEFT JOIN (SELECT * FROM information_schema.columns WHERE TABLE_SCHEMA = @target_db) c2
ON c1.TABLE_name = c2.TABLE_name AND c1.column_name = c2.column_name
@seagoj
seagoj / mysql_db_copy.sql
Created January 27, 2014 15:26
Duplicate Mysql DB
mysqldump -u root -p[password] [db_src] | mysql -u root -p[password] [db_dest]
@seagoj
seagoj / 0_reuse_code.js
Created March 18, 2014 19:13
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@seagoj
seagoj / gist:10736442
Created April 15, 2014 14:19
Custom error handler
public static function error_handler($errno, $errstr, $errfile, $errline, $errcontext) {
global $errorLog;
if (is_array($errstr) || is_object($errstr)) {
$errstr = var_export($errstr, true);
}
$message = "$errno:$errfile:$errline:$errstr:".json_encode($errcontext);
if (isset($errorLog) && get_class($errorLog)==='Devtools\Log') {
$errorLog->write($message, false);
} else {
echo $message;
@seagoj
seagoj / msmq.php
Created June 3, 2014 19:57
PHP:MSMQ
<?php
define(MQ_SEND_ACCESS , 2);
define(MQ_DENY_NONE , 0);
$msgQueueInfo = new COM("MSMQ.MSMQQueueInfo") or die("can not create MSMQ Info object");
$msgQueueInfo->PathName = ".\TestQueue";
$msgQueue = new COM("MSMQ.MSMQQueue") or die("can not create MSMQ object");
$msgQueue=$msgQueueInfo->Open(MQ_SEND_ACCESS, MQ_DENY_NONE );
@seagoj
seagoj / gist:db02f7fdacabd3a22080
Created September 29, 2014 20:50
Vimscript Issue
function! TagbarGotoTag()
normal! "zyiw
call tagbar#OpenWindow('fcj')
:exe "/".@z.""
" Need to send a carriage return here to select the tag
:nohlsearch
endfunction
@seagoj
seagoj / gist:917d941c5f91138b42c7
Last active August 29, 2015 14:07
Interfaces and type hints
interface Entity {}
class UserEntity implements Entity {}
interface Repository
{
public function persist(Entity $entity);
}
class UserRepository implements Repository
{