Skip to content

Instantly share code, notes, and snippets.

View millermedeiros's full-sized avatar

Miller Medeiros millermedeiros

View GitHub Profile
@millermedeiros
millermedeiros / store.js
Created September 27, 2014 21:37
gaia calendar helpers
// 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 March 25, 2014 16:25
shell aliases and commands to help Gaia/B2G (Firefox OS) development - specially for the "productivity" apps
# 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"
@millermedeiros
millermedeiros / osx_setup.md
Last active November 14, 2024 03:45
Mac OS X setup

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 December 23, 2015 06:49 — forked from rmurphey/gist:5052882
rename "setLocationOnEvent" to "setLocationOnValChange"
/*****************************************************************************
* __ __ _ _ ___ _
* \ \/ _\ /\/\ (_)_ __ | |_ _ _ / __\ __ ___ ___| |__
* \ \ \ / \| | '_ \| __| | | | / _\| '__/ _ \/ __| '_ \
* /\_/ /\ \ / /\/\ \ | | | | |_| |_| | / / | | | __/\__ \ | | |
* \___/\__/ \/ \/_|_| |_|\__|\__, | \/ |_| \___||___/_| |_|
* |___/
*
* Identifying and Eliminating Code Smells
*
@millermedeiros
millermedeiros / build.js
Created June 6, 2013 14:26
node.js build script using commander and shelljs
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 September 10, 2022 03:06
execute multiple shell commands in series on node.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 October 11, 2015 12:37
Shell script to update 3rd party libs
#!/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 September 26, 2012 14:40
amd-utils array methods to mimic ES6 Set
// 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 August 28, 2012 13:52
node.js script to inline static includes
<!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 July 18, 2012 15:06
find closest number in the sequence (1, 5, 10, 50, 100, 500, 1000, ...) that generates less than "n" steps
//
// 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;