Skip to content

Instantly share code, notes, and snippets.

View moimikey's full-sized avatar
:shipit:
ship it

Michael Scott Hertzberg moimikey

:shipit:
ship it
View GitHub Profile
@domenic
domenic / interop.md
Last active July 7, 2022 19:47
`module.exports =` and ES6 Module Interop in Node.js

module.exports = and ES6 Module Interop in Node.js

The question: how can we use ES6 modules in Node.js, where modules-as-functions is very common? That is, given a future in which V8 supports ES6 modules:

  • How can authors of function-modules convert to ES6 export syntax, without breaking consumers that do require("function-module")()?
  • How can consumers of function-modules use ES6 import syntax, while not demanding that the module author rewrites his code to ES6 export?

@wycats showed me a solution. It involves hooking into the loader API to do some rewriting, and using a distinguished name for the single export.

This is me eating crow for lots of false statements I've made all over Twitter today. Here it goes.

@cowboy
cowboy / Gruntfile.js
Last active December 12, 2015 09:59
grunt 0.4.0: including dotfiles
module.exports = function(grunt) {
// Project configuration.
grunt.initConfig({
test: {
non_expand: {
files: [
{src: '*', dest: 'build', dot: true},
]
},
@maccman
maccman / jquery.ajax.queue.coffee
Last active January 13, 2018 12:03
Queueing jQuery Ajax requests. Usage $.ajax({queue: true})
$ = jQuery
queues = {}
running = false
queue = (name) ->
name = 'default' if name is true
queues[name] or= []
next = (name) ->
$ = jQuery
TIMEOUT = 20000
lastTime = (new Date()).getTime()
setInterval ->
currentTime = (new Date()).getTime()
# If timeout was paused (ignoring small
# variations) then trigger the 'wake' event
if currentTime > (lastTime + TIMEOUT + 2000)
$ = jQuery
$.fn.lineHeight or= ->
if height = @data('lineHeight')
return height
# Create a hidden div with the same font
# properties, then measure its height
$shadow = $('<span />')
$shadow.css({
$ = jQuery
$.activeTransforms = 0
$(document).ajaxSend (e, xhr, settings) ->
return unless settings.warn
$.activeTransforms += 1
$(document).ajaxComplete (e, xhr, settings) ->
return unless settings.warn
@ericelliott
ericelliott / feature-toggles.md
Last active August 5, 2018 08:59
Feature Toggles - First Draft

Feature Toggle

Continuous deployment is the process of testing, integrating, and deploying software in rapid cycles in order to deliver bug fixes and new features to customers as quickly as possible. It gained popular acceptance as a cornerstone of extreme programming and agile development. It is very popular among Software as a Service providers.

A feature toggle system allows you to integrate features into your codebase even before they're finished and ready to release. During development, the features are toggled off by default. In order to turn them on, you must enable them manually. Using this method, you can deploy unfinished or untested changes into your production system without interfering with the user experience.

Feature toggles can allow software integration cycles that run in weeks, days, or even hours, as opposed to months or years. They are an essential component in a broader continuous integration system.

Feature toggles are popular in the startup community, but have gained widespr


To access the developer tools, on any web page or app in Google Chrome you can use one of these options:

  • Select the Wrench menu at the top-right of your browser window, then select Tools → Developer tools.
  • Right-click on any page element and select Inspect element.
  • Shortcut keys:
@brian-mann
brian-mann / gist:7085079
Last active July 13, 2023 08:37
Expanded version of loading controller with edge cases covered
showRealView: (realView, loadingView, config) ->
xhrs = App.request "fetched:entities", config.entities
## ...after the entities are successfully fetched, execute this callback
$.when(xhrs...).done =>
## ================================================================ ##
## If the region we are trying to insert is not the loadingView then
## we know the user has navigated to a different page while the loading
## view was still open. In that case, we know to manually close the original
## view so its controller is also closed. We also prevent showing the real
@brian-mann
brian-mann / gist:7085402
Last active September 3, 2017 20:14
The latest and greatest folder and file structure for Backbone / Marionette Apps
##Folder structure
/backbone
app.js
/apps
/entities
/lib
##Inside Apps
/apps