Skip to content

Instantly share code, notes, and snippets.

Alejandro Gomez alexserver

Block or report user

Report or block alexserver

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
alexserver / functional-sample
Created Mar 18, 2014
functional programming blowmind
View functional-sample
var everyDocument = function (collection, fn, a, b, c) {
return collection.forEach(function(element, index){
fn(element, index, a, b, c);
View page.php
* The template for displaying all pages.
* This is the template that displays all pages by default.
* Please note that this is the WordPress construct of pages
* and that other 'pages' on your WordPress site will use a
* different template.
* @package WordPress
View chaijs
var ChaiJS = require("chai");
// make ChaiJS + SinonJS available to all tests
GLOBAL.should = ChaiJS.should;
GLOBAL.expect = ChaiJS.expect;
GLOBAL.assert = ChaiJS.assert;
View .profile
# add these aliases to your BASH profile ~/.profile
alias mongodb-start="mongod run --config /usr/local/etc/mongod.conf"
alias redis-start="redis-server /usr/local/etc/redis.conf"
alias mongodb-stop="mongod --shutdown"
alias redis-stop="redis-cli shutdown"
# TODO fix mongod shutdown
alexserver / RegReplace custom conf
Created Nov 5, 2014
Custom configuration to remove garbage from google docs.
View RegReplace custom conf
// Configuration for removing html tags enclosing ractive conditionals, and also for removing html tags
// Defualt.sublime-commands
// To configure the commands that will be available in the command palette (Cmd + shift + P)
"caption": "Reg Replace: Google Docs delete garbage",
"command": "reg_replace",
alexserver / update_mongodb
Created Nov 18, 2014
update many records in mongodb
View update_mongodb
//in SQL
update mydoc set word = replace(word, 'some_undesired_word', '')
//in mongodb
if (!doc.word) return;
doc.word = doc.word.replace('some_undesired_word', '');
db.mydoc.update({_id : doc._id}, {"$set":{"word":doc.word}});
View gist:917089b4ce10fd6faaee
$ cd /usr/local
$ git fetch origin
$ git reset --hard origin/master
alexserver / settings_user
Created Dec 23, 2014
settings user regReplace
View settings_user
"replacements": {
// Example replacements
"google_docs_remove_html": {
"find": "(.|\\n)*<body((?!>).)*>(((?!<\\/body>).|\\n)+)<\\/body>(.|\\n)*",
"replace": "\\3",
"greedy": false,
"case": false
"google_docs_remove_ractive_rows": {
alexserver / commands_user
Created Dec 23, 2014
Commands User RegReplace
View commands_user
"caption": "Reg Replace: Google Docs to Ractive",
"command": "reg_replace",
"args": {"replacements": [
View siftjs
var sift = require("sift");
// var torender = [ { keypath: 'employee',
// template: '{{first_name}} {{ last_name }}' },
// { keypath: 'employee.division', template: '{{division}}' },
// { keypath: 'certificate_type',
// template: '{{#peoplesoft_id}}{{peoplesoft_id}}: {{/peoplesoft_id}}{{title}}' } ];
var objects = [
{n: 3},
You can’t perform that action at this time.