Skip to content

Instantly share code, notes, and snippets.

Miller Medeiros millermedeiros

View GitHub Profile
@millermedeiros
millermedeiros / store.js
Created Sep 27, 2014
gaia calendar helpers
View store.js
// jshint esnext:true
var app = Calendar.App;
var busyStore = app.store('Busytime');
var calendarStore = app.store('Calendar');
var eventStore = app.store('Event');
var syncController = app.syncController;
@millermedeiros
millermedeiros / b2g.sh
Created Mar 25, 2014
shell aliases and commands to help Gaia/B2G (Firefox OS) development - specially for the "productivity" apps
View b2g.sh
# based on https://github.com/gnarf/.dotfiles/blob/master/b2g.sh
# =============================================================================
export FIREFOX="/Applications/FirefoxNightly.app/Contents/MacOS/firefox"
export GAIA_DIR="/Users/millermedeiros/Projects/gaia"
alias firefox="$FIREFOX"
alias b2g-bin="$GAIA_DIR/b2g/Contents/MacOS/b2g-bin"
alias b2g="b2g-bin"
View osx_setup.md

Setup Mac OS X

I've done the same process every couple years since 2013 (Mountain Lion, Mavericks, High Sierra, Catalina) and I updated the Gist each time I've done it.

I kinda regret for not using something like Boxen (or anything similar) to automate the process, but TBH I only actually needed to these steps once every couple years...

@millermedeiros
millermedeiros / gist:6595977
Last active Dec 23, 2015 — forked from rmurphey/gist:5052882
rename "setLocationOnEvent" to "setLocationOnValChange"
View gist:6595977
/*****************************************************************************
* __ __ _ _ ___ _
* \ \/ _\ /\/\ (_)_ __ | |_ _ _ / __\ __ ___ ___| |__
* \ \ \ / \| | '_ \| __| | | | / _\| '__/ _ \/ __| '_ \
* /\_/ /\ \ / /\/\ \ | | | | |_| |_| | / / | | | __/\__ \ | | |
* \___/\__/ \/ \/_|_| |_|\__|\__, | \/ |_| \___||___/_| |_|
* |___/
*
* Identifying and Eliminating Code Smells
*
@millermedeiros
millermedeiros / build.js
Created Jun 6, 2013
node.js build script using commander and shelljs
View build.js
var DIST_FOLDER = '../site/public';
// ----
// more references:
// https://gist.github.com/millermedeiros/2640928
// https://gist.github.com/millermedeiros/4724047
@millermedeiros
millermedeiros / example.js
Last active Jun 24, 2020
execute multiple shell commands in series on node.js
View example.js
// USAGE ------
// ============
var shell = require('./shellHelper');
// execute a single shell command
shell.exec('npm test --coverage', function(err){
console.log('executed test');
}});
@millermedeiros
millermedeiros / updateLibs.sh
Last active Oct 11, 2015
Shell script to update 3rd party libs
View updateLibs.sh
#!/bin/sh
# This shell script is used to bootstrap the app and update external libraries
#
# ====== IMPORTANT ======
#
# it may break application if 3rd party libs aren't backwards compatible
# or if libs were edited locally, use with care !!!
@millermedeiros
millermedeiros / Set.js
Created Sep 26, 2012
amd-utils array methods to mimic ES6 Set
View Set.js
// If OOP is "your thing" it can be easily abstracted into a constructor
define(
[
'amd-utils/array/insert',
'amd-utils/array/remove',
'amd-utils/array/contains',
'amd-utils/array/forEach'
],
function (insert, remove, contains, forEach) {
@millermedeiros
millermedeiros / example.html
Created Aug 28, 2012
node.js script to inline static includes
View example.html
<!DOCTYPE html>
<!-- #include "inc_header.html" title="Example" header="Sample Title" -->
<html>
<head>
<meta charset="utf-8">
<title>Example</title>
<link rel="stylesheet" href="css/main.css">
</head>
<body>
<h1>Sample Title</h1>
@millermedeiros
millermedeiros / gist:3136745
Created Jul 18, 2012
find closest number in the sequence (1, 5, 10, 50, 100, 500, 1000, ...) that generates less than "n" steps
View gist:3136745
//
// find closest number in the sequence (1, 5, 10, 50, 100, 500, 1000, ...)
// that generates less than "n" steps
// ---
// useful for subdividing charts and any other things that requires a scale
// that follows reasonable numbers
//
function getStepSize(val, maxNSteps) {
var nSteps;
var stepSize = 1;
You can’t perform that action at this time.