Skip to content

Instantly share code, notes, and snippets.

View mrnosal's full-sized avatar

Mike Nosal mrnosal

  • MITRE Corporation
  • Bedford, MA
View GitHub Profile
@jeffery
jeffery / GitRepoUpdateTimestamp.sh
Created July 30, 2011 13:04
Update Timestamp of files in Checked-out Git Repository
#!/bin/bash -e
####
# Helper script to update the Last modified timestamp of files in a Git SCM
# Projects working Copy
#
# When you clone a Git repository, it sets the timestamp of all the files to the
# time when you cloned the repository.
#
# This becomes a problem when you want the cloned repository, which is part of a
# Web application have a proper cacheing mechanism so that it can re-cache files
@paulirish
paulirish / data-markdown.user.js
Last active February 6, 2024 10:41
*[data-markdown] - use markdown, sometimes, in your HTML
// ==UserScript==
// @name Use Markdown, sometimes, in your HTML.
// @author Paul Irish <http://paulirish.com/>
// @link http://git.io/data-markdown
// @match *
// ==/UserScript==
// If you're not using this as a userscript just delete from this line up. It's cool, homey.
@alexaivars
alexaivars / setter_pattern.coffee
Created January 12, 2012 08:41
Getter Setter patter for Coffeescript
Function::define = (prop, desc) ->
Object.defineProperty this.prototype, prop, desc
class GetterSetterTest
constructor: (@_obj = {}) ->
# 'obj' is defined via the prototype, the definition proxied through
# to 'Object.defineProperty' via a function called 'define' providing
# some nice syntactic sugar. Remember, the value of '@' is
# GetterSetterTest itself when used in the body of it's class definition.
@cfjedimaster
cfjedimaster / gist:2313466
Created April 5, 2012 19:33
Conditional jQuery resource get
<!DOCTYPE html>
<html>
<head>
<title>Conditional Get</title>
<script src="http://code.jquery.com/jquery-1.7.1.min.js"></script>
<script>
$(document).ready(function() {
var theResource = "dump.zip";
@domenic
domenic / promises.md
Last active June 24, 2024 03:11
You're Missing the Point of Promises

This article has been given a more permanent home on my blog. Also, since it was first written, the development of the Promises/A+ specification has made the original emphasis on Promises/A seem somewhat outdated.

You're Missing the Point of Promises

Promises are a software abstraction that makes working with asynchronous operations much more pleasant. In the most basic definition, your code will move from continuation-passing style:

getTweetsFor("domenic", function (err, results) {
 // the rest of your code goes here.
@OllyHodgson
OllyHodgson / sparkline.svg
Created January 7, 2013 09:50
Stuart Langridge's Simple SVG sparklines — http://kryogenix.org/days/2012/12/30/simple-svg-sparklines — but using an object element instead of an embed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@benbalter
benbalter / geojson-conversion.sh
Last active April 23, 2024 13:16
Bulk convert shapefiles to geojson using ogr2ogr
# Bulk convert shapefiles to geojson using ogr2ogr
# For more information, see http://ben.balter.com/2013/06/26/how-to-convert-shapefiles-to-geojson-for-use-on-github/
# Note: Assumes you're in a folder with one or more zip files containing shape files
# and Outputs as geojson with the crs:84 SRS (for use on GitHub or elsewhere)
#geojson conversion
function shp2geojson() {
ogr2ogr -f GeoJSON -t_srs crs:84 "$1.geojson" "$1.shp"
}
@bycoffe
bycoffe / README.md
Created June 26, 2013 20:19
Town/county map using d3 and TopoJSON

This is a demonstration of how to create a combination town/county map from a shapefile using TopoJSON and d3.js.

It includes a simplified version of the code used for the Massachusetts special Senate election results on The Huffington Post.

Get the data

Download a shapefile of Massachusetts towns from the state's GIS site:

wget http://wsgw.mass.gov/data/gispub/shape/census2000/towns/census2000towns_poly.exe
@mudkipme
mudkipme / app-base.js
Created August 13, 2013 16:35
Extend Marionette.Application for async initialization
define([
'underscore'
,'marionette'
], function(_, Marionette){
var $ = Marionette.$;
// Extend Marionette.Application for async initialization
var AppBase = Marionette.Application.extend({
constructor: function(options){
@slashdotdash
slashdotdash / Gruntfile.js
Created February 19, 2014 22:15
Grunt config to with task to compile React .jsx files to .js
/*global module:false*/
module.exports = function(grunt) {
grunt.initConfig({
react: {
jsx: {
files: [
{
expand: true,
cwd: 'public/js',