Skip to content

Instantly share code, notes, and snippets.

View foxnewsnetwork's full-sized avatar

Thomas Chen foxnewsnetwork

View GitHub Profile
@foxnewsnetwork
foxnewsnetwork / arbitrage.jl
Last active November 30, 2017 04:34
ch04-bond-present-value-supplemental
function maturityYield(presVal, couponRate, time)
f(y) = 1 / y ^ time + sigma(1:time, t -> couponRate / y ^ t) - presVal
fzero(f, 0.5, 2.5)
end
import Ember from 'ember';
const { RSVP } = Ember;
const { anime } = window;
const scrollHolder = async (i) => new RSVP.Promise((resolve) => anime({
targets: '.card-scroller',
translateX: -i * 225,
easing: 'easeInOutSine',
duration: 750,
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle'
});
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Ember Starter Kit</title>
<link rel="stylesheet" href="http://cdnjs.cloudflare.com/ajax/libs/normalize/3.0.1/normalize.css">
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script src="http://builds.emberjs.com/tags/v1.11.3/ember-template-compiler.js"></script>
<script src="http://builds.emberjs.com/tags/v1.11.3/ember.debug.js"></script>
<style id="jsbin-css">
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Ember Starter Kit</title>
<link rel="stylesheet" href="http://cdnjs.cloudflare.com/ajax/libs/normalize/3.0.1/normalize.css">
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script src="http://builds.emberjs.com/tags/v1.11.3/ember-template-compiler.js"></script>
<script src="http://builds.emberjs.com/tags/v1.11.3/ember.debug.js"></script>
<style id="jsbin-css">
import Ember from 'ember';
import ajax from 'ember-ajax/request';
import { task } from 'ember-concurrency';
const { isPresent, get, set } = Ember;
export default Ember.Component.extend({
loadTask: task(function*(uri) {
const { links } = yield ajax(uri);
return links;
@foxnewsnetwork
foxnewsnetwork / fonts.markdown
Last active May 29, 2018 15:33
Getting Started with react-native

Fonts and other vector assets

As an ember developer accustomed to the "batteries-included" mentality of sensible defaults and convention over configuration, getting into the groove of react-native can be a little tricky - especially for seemingly should-be-simple things such as including fonts in our app.

rnpm link

In ember-cli land, installing font-awesome (or any font) was done with a simple cli command: ember install ember-cli-font-awesome. In react native, similar packages exist, but the installation instructions require a little more research on my part. Here's how it's done:

mkdir -p assets/fonts
@foxnewsnetwork
foxnewsnetwork / ember-redux-data.markdown
Created March 17, 2017 17:09
Eating one's own dog food with ember-redux-data
  1. updaters/model and actions/model should be far more extensible and, in fact, should not come packaged with redux-actions
@foxnewsnetwork
foxnewsnetwork / README.markdown
Created February 23, 2017 23:04
How to get ember-life working in your 1.x.x ember app

What?

Are you using setInterval, setTimeout, or Ember.run in your components?

If the answer is "yes", you probably should look into using https://www.npmjs.com/package/ember-lifeline instead

Why?

The read the long answer on the addon repo itself, but the TL;DR is using ember-lifeline plays better with component life-cycles and avoids your queues never flushing

What's the problem

You can't use it if you're in 1.x.x... even though you probably need the most. This is because the import statements expect ember-metal which isn't a thing in the earlier versions

@foxnewsnetwork
foxnewsnetwork / README.markdown
Created January 5, 2017 21:25
How to shim commonjs files in addons with ember-cli without using ember-browserify

The Problem

Say you're building an ember addon that has a commonjs dependency, what do you do?

That is, you have a commonjs file dependency that looks something like:

module.exports = {
  whatever: function() { ... }
}