Skip to content

Instantly share code, notes, and snippets.

@schmurfy
schmurfy / gist:3199254
Created July 29, 2012 14:33
Install pandoc Mac OS X 10.8
# Install MacTex: http://mirror.ctan.org/systems/mac/mactex/mactex-basic.pkg
$ sudo chown -R `whoami` /usr/local/texlive
$ tlmgr update --self
$ tlmgr install ucs
$ tlmgr install etoolbox
# Install pandoc view homebrew
@machty
machty / router-facelift-guide.md
Last active July 10, 2024 15:14
Guide to the Router Facelift

Ember Router Async Facelift

The Ember router is getting number of enhancements that will greatly enhance its power, reliability, predictability, and ability to handle asynchronous loading logic (so many abilities), particularly when used in conjunction with promises, though the API is friendly enough that a deep understanding of promises is not required for the simpler use cases.

@alexspeller
alexspeller / base64encode.js.coffee
Last active December 21, 2015 04:38
Ember Table Extensions
# So, this is pretty horrible. If we just encode using btoa, any UTF-8 chars cause an error.
# If we use either of the workarounds on MDN[1], the £ sign is encoded wrong. I suspect
# Excel totally sucking at encodings is the reason why. So, the workaround is, to use
# the MDN workaround on chars with values > 255, and allow chars 0-255 to be encoded
# as is with btoa. Note that if you use either of the workarounds on MDN, chars
# 128-255 will be encoded as UTF-8, which includeds the £ sign. This will cause excel
# to choke on these chars. Excel will still choke on chars > 255, but at least the £
# sign works now...
# [1] https://developer.mozilla.org/en-US/docs/Web/JavaScript/Base64_encoding_and_decoding
@stevekane
stevekane / gist:6356006
Created August 27, 2013 16:44
ClickElsewhereMixin (an Ember mixin used to detect clicks outside a view) Original Attribution: Alex Speller's gist at https://gist.github.com/alexspeller/6251054
#original attribution https://gist.github.com/alexspeller/6251054
bound = (fnName) -> Ember.computed fnName -> @get(fnName).bind(@)
App.ClickElsewhereMixin = Ember.Mixin.create
#use this method hook to define your desired behavior
onClickElsewhere: Ember.K
#bound version of our instance method
@johnkpaul
johnkpaul / component-list.md
Last active December 24, 2015 12:19
Ember.Component list
@machty
machty / router-js-refactor-architecture.md
Last active July 31, 2019 18:39
Overview of the architecture and approach to the router.js refactor

router.js Architecture

Let this serve as a guide for anyone who'd like to dig into router.js's internals, understand what's going on, and hopefully contribute!

Scope of router.js (et al)

router.js is most popularly known as the routing microlib used by the Ember.js Router, though other folk have been known to use it beyond Ember, including some Angular folk who weren't satisfied with

@bradwright
bradwright / private.xml
Last active August 29, 2015 14:00
KeyRemap4MacBook XML configuration for the Tarmak transitional layout
<?xml version="1.0"?>
<root>
<item>
<name>Tarmak transitional layout</name>
<!-- http://forum.colemak.com/viewtopic.php?pid=8786#p8786 -->
<item>
<name>Tarmak1(E) transitional layout (E&gt;K&gt;N&gt;J)</name>
<identifier>private.tarmak.tarmak_1_e</identifier>
<autogen>__KeyToKey__ KeyCode::K, KeyCode::E</autogen>
<autogen>__KeyToKey__ KeyCode::N, KeyCode::K</autogen>
@teechap
teechap / heatmap_example.py
Created September 18, 2014 00:35
How to make a heatmap from data stored in Python lists
'''
Most heatmap tutorials I found online use pyplot.pcolormesh with random sets of
data from Numpy; I just needed to plot x, y, z values stored in lists--without
all the Numpy mumbo jumbo. Here I have code to plot intensity on a 2D array, and
I only use Numpy where I need to (pcolormesh expects Numpy arrays as inputs).
'''
import matplotlib.pyplot as plt
import numpy as np
#here's our data to plot, all normal Python lists
@samselikoff
samselikoff / future-proof.md
Last active April 21, 2023 17:14
Future-proofing your Ember 1.x code

This post is also on my blog, since Gist doesn't support @ notifications.


Components are taking center stage in Ember 2.0. Here are some things you can do today to make the transition as smooth as possible:

  • Use Ember CLI
  • In general, replace views + controllers with components
  • Only use controllers at the top-level for receiving data from the route, and use Ember.Controller instead of Ember.ArrayController or Ember.ObjectController
  • Fetch data in your route, and set it as normal properties on your top-level controller. Export an Ember.Controller, otherwise a proxy will be generated. You can use Ember.RSVP.hash to simulate setting normal props on your controller.
@ryanabel03
ryanabel03 / application-adapter.coffee
Created March 27, 2016 23:46
Ember.js Network Request Retries
ApplicationAdpater = DS.ActiveModelAdapter.extend
synchronizer: Em.inject.service()
ajax: (url, type, options) ->
hash = @ajaxOptions(url, type, options)
# set up hash.success &amp; hash.error callbacks normally
@get('synchronizer').handleRequest(hash)