Skip to content

Instantly share code, notes, and snippets.

View alexserver's full-sized avatar
🤓
Learning

Alejandro Gomez alexserver

🤓
Learning
View GitHub Profile
@alexserver
alexserver / functional-sample
Created March 18, 2014 03:09
functional programming blowmind
var everyDocument = function (collection, fn, a, b, c) {
return collection.forEach(function(element, index){
fn(element, index, a, b, c);
});
};
@alexserver
alexserver / page.php
Last active August 29, 2015 13:57 — forked from jonexe/page.php
<?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
var ChaiJS = require("chai");
// make ChaiJS + SinonJS available to all tests
GLOBAL.should = ChaiJS.should;
GLOBAL.expect = ChaiJS.expect;
GLOBAL.assert = ChaiJS.assert;
@alexserver
alexserver / .profile
Last active August 29, 2015 14:02 — forked from kenzie/.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
alexserver / RegReplace custom conf
Created November 5, 2014 14:50
Custom configuration to remove garbage from google docs.
// 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
alexserver / update_mongodb
Created November 18, 2014 19:30
update many records in mongodb
//in SQL
update mydoc set word = replace(word, 'some_undesired_word', '')
//in mongodb
db.mydoc.find().forEach(function(doc){
if (!doc.word) return;
doc.word = doc.word.replace('some_undesired_word', '');
db.mydoc.update({_id : doc._id}, {"$set":{"word":doc.word}});
});
$ cd /usr/local
$ git fetch origin
$ git reset --hard origin/master
@alexserver
alexserver / settings_user
Created December 23, 2014 23:08
settings user regReplace
{
"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
alexserver / commands_user
Created December 23, 2014 23:09
Commands User RegReplace
[
{
"caption": "Reg Replace: Google Docs to Ractive",
"command": "reg_replace",
"args": {"replacements": [
"google_docs_remove_html",
"google_docs_remove_ractive_rows",
"unescape_html_tags_for_markup_open",
"unescape_html_tags_for_markup_close"
]}
@alexserver
alexserver / siftjs
Created January 16, 2015 20:22
sift
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},