Skip to content

Instantly share code, notes, and snippets.

View shane-reaume's full-sized avatar

Shane Reaume shane-reaume

View GitHub Profile
# NERDTree
o.......Open files, directories and bookmarks....................|NERDTree-o|
go......Open selected file, but leave cursor in the NERDTree.....|NERDTree-go|
t.......Open selected node/bookmark in a new tab.................|NERDTree-t|
T.......Same as 't' but keep the focus on the current tab........|NERDTree-T|
i.......Open selected file in a split window.....................|NERDTree-i|
gi......Same as i, but leave the cursor on the NERDTree..........|NERDTree-gi|
s.......Open selected file in a new vsplit.......................|NERDTree-s|
gs......Same as s, but leave the cursor on the NERDTree..........|NERDTree-gs|
O.......Recursively open the selected directory..................|NERDTree-O|
#Cursor movement
h - move left
j - move down
k - move up
l - move right
ctrl-b - page up
ctrl-f - page down
% - jump to matching brace
w - jump by start of words (punctuation considered words)
@shane-reaume
shane-reaume / mocha-guide-to-testing.js
Last active September 23, 2016 17:51 — forked from samwize/mocha-guide-to-testing.js
Explain Mocha's testing framework - describe(), it() and before()/etc hooks
// # Mocha Guide to Testing
// Objective is to explain describe(), it(), and before()/etc hooks
// 1. `describe()` is merely for grouping, which you can nest as deep
// 2. `it()` is a test case
// 3. `before()`, `beforeEach()`, `after()`, `afterEach()` are hooks to run
// before/after first/each it() or describe().
//
// Which means, `before()` is run before first it()/describe()
@shane-reaume
shane-reaume / test.njs
Created September 29, 2013 20:06
Node headless (phantom.js) connection and search with the selenium-webdriver library
var webdriver = require('selenium-webdriver');
var driver = new webdriver.Builder().
withCapabilities(webdriver.Capabilities.phantomjs()).
build();
driver.get('http://www.duckduckgo.com');
driver.findElement(webdriver.By.id('search_form_input_homepage')).sendKeys('nodejs');
driver.findElement(webdriver.By.id('search_button_homepage')).click();
var g = driver.getCurrentUrl();
g.then(function(u) {
console.log("URL is: " + u);
@shane-reaume
shane-reaume / header.php
Created April 10, 2013 18:52
Bookmark This Page
function bookmarkPage(url,title) {
if (!url) {url = window.location}
if (!title) {title = document.title}
var browser=navigator.userAgent.toLowerCase();
if (window.sidebar) { // Mozilla, Firefox, Netscape
window.sidebar.addPanel(title, url,"");
} else if( window.external) { // IE or chrome
if (browser.indexOf('chrome')==-1){ // ie
window.external.AddFavorite( url, title);
} else { // chrome
@shane-reaume
shane-reaume / allsite.js
Created April 10, 2013 16:33
Form filters
/**
* Created By: Shane Reaume
* Date: 12/17/12
* Time: 10:20 AM
*/
/* form filters -Shane */
$(function() {
var yourFacilityinput = $('label:contains("Your Facility")').parent('div').find('input');
@shane-reaume
shane-reaume / js_bottom.js
Last active December 15, 2015 18:39
Remove attributes then add with mouse or click
(function($){
$('form.ProductReviewForm').attr('action', '')
.attr('method', '');
$(".demo").remove();
$(document).ready(function() {
$('#TopMenu').css({
'border-radius':'0 0 5px 5px'
,'box-shadow':'2px 2px 3px #999999'
});
$('#Menu').css({
@shane-reaume
shane-reaume / testdatapull.php
Created February 21, 2013 01:04
JSCharts, improve label and tooltip values for larger data with PHP
<?php
$e1 = 1;
$e2 = $e1;
$e3 = --$e2;
while ($e1 <= $counting) {
echo "myChart.setLabelX([".$e1.",'".$e1++."']);";
}
while( $e2 <= $counting ) {
$value = $teststring[$e3++];
@shane-reaume
shane-reaume / footer.php
Created January 21, 2013 23:36
Copyright start year, and update every year
@shane-reaume
shane-reaume / validation.php
Created November 2, 2012 23:13
Server-side(PHP) validation of phone number that also prevents multiple of same digit, i.e. all 1's
function phonenumber($value)
{
$areacode = '[2-9]{1}\d{1}\d{1}'; // You might want to specify '2\d\d' (200 to 299)
$prefix = '[2-9]{1}\d{1}\d{1}';
$regex = '#^(\('.$areacode.'\)|'.$areacode.')[\s\.-]?'.$prefix.'[\.-]?\d{4}$#';
if (preg_match($regex, $value))
{
// Number now is in a suitable format
// extract digits -- remove this section to not test repeated pattern