Skip to content

Instantly share code, notes, and snippets.

View millermedeiros's full-sized avatar

Miller Medeiros millermedeiros

View GitHub Profile
@millermedeiros
millermedeiros / index.html
Created September 3, 2011 16:20
Example of how to use a single JS file for multiple pages of an application
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Example</title>
<meta name="description" content="This is just an example">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="css/main.css">
</head>
<body data-modules="foobar, lorem/ipsum">
@millermedeiros
millermedeiros / AbstractModel.js
Created September 20, 2011 20:39
AbstractModel.js
define(['jquery'], function($){
var DEFAULT_DATA_TYPE = 'json';
/**
* Abstract REST service model.
* @author Miller Medeiros
* @version 0.3.1 (2011/09/21)
* @param {object} [services] Services
* @see AbstractModel.services
@millermedeiros
millermedeiros / build-main_settings.js
Created September 23, 2011 14:33
Another example of single entry point with RequireJS + individual section/module versioning
({
//settings for the r.js optimizer
baseUrl : '../js',
name : 'main',
out : '../deploy/js/main-v2.js', //here you can set the versioning
excludes : [
//so we can load those modules only when needed, also to make sure
//individual versioning of sections also work as expected.
'sections/search/main',
'sections/news/main',
@millermedeiros
millermedeiros / universal-module.js
Created September 29, 2011 19:21 — forked from ryanflorence/universal-module.js
Universal JavaScript Module, supports AMD (RequireJS), Node.js, and the browser.
(function(def){
def('myModule', ['someDependency', 'somethingElse'], function(someDependency, somethingElse){
//return the module's API
return {};
});
}(
// wrapper to run code everywhere
typeof define === 'function' && define.amd?
@millermedeiros
millermedeiros / json.js
Created September 30, 2011 21:25
RequireJS plugin to load JSON files
/*!
* RequireJS plugin for loading JSON files
* - depends on Text plugin and it was HEAVILY "inspired" by it as well.
*
* IMPORTANT: it only works on r.js optimizer after version 0.26+ 20011/09/27
*
* @author Miller Medeiros
* @version 0.0.1 (2011/06/10)
* Released under the WTFPL <http://sam.zoy.org/wtfpl/>
*/
@millermedeiros
millermedeiros / .vimrc
Last active September 27, 2025 02:50
My VIM settings (.vimrc)
" =============================================================================
" Miller Medeiros .vimrc file
" -----------------------------------------------------------------------------
" heavily inspired by: @factorylabs, @scrooloose, @nvie, @gf3, @bit-theory, ...
" =============================================================================
" -----------------------------------------------------------------------------
" BEHAVIOR
@millermedeiros
millermedeiros / gist:1340046
Created November 4, 2011 18:09
node.js CLI to compress TexturePacker JSON-Array data
#!/usr/bin/env node
//npm install commander
/**
* Command line tool to convert TexturePacker JSON-Array data into
* optimized SpriteAnim.js JSON data file.
* @author Miller Medeiros
* @version 0.1.0 (2011/10/18)
*/
@millermedeiros
millermedeiros / wordcount.vim
Created November 10, 2011 22:30
wordcount.vim : fast word and char count for vim to be used on the status line
" ============================================================================
" File: wordcount.vim
" Maintainer: Miller Medeiros <http://blog.millermedeiros.com/>
" Description: Fast Word and Char count to be used on the statusline.
" based on Greg Sexton script: http://bit.ly/v3RfAv
" Last Change: 2011-11-10
" License: This program is free software. It comes without any warranty,
" to the extent permitted by applicable law. You can redistribute
" it and/or modify it under the terms of the Do What The Fuck You
" Want To Public License, Version 2, as published by Sam Hocevar.
@millermedeiros
millermedeiros / index.html
Created January 4, 2012 17:46
Simple Markdown previewer with github-style codeblocks support
<!doctype html>
<meta charset="utf-8">
<title>Using Showdown with and without jQuery: demo</title>
<style>
textarea, #preview { width: 500px; height: 150px; margin-bottom: 1em; padding: .5em 1em; overflow-y:auto}
#preview { border: 1px solid #666; }
</style>
<link rel="first" href="http://mathiasbynens.be/notes/showdown-javascript-jquery" title="Using Showdown with and without jQuery">
<link rel="prefetch" href="http://mathiasbynens.be/notes/showdown-javascript-jquery" title="Using Showdown with and without jQuery">
<link rel="stylesheet" href="http://yandex.st/highlightjs/6.1/styles/default.min.css">
@millermedeiros
millermedeiros / gist:1873712
Created February 21, 2012 04:38
how to filter and batch delete files on node.js
var DIST_FOLDER = '../deploy/';
// ---
var _minimatch = require('minimatch'),
_wrench = require('wrench'),
_fs = require('fs'),
_path = require('path');
function purgeDeploy(){