This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const COLUMN_DELIMITER = ','; | |
export function csvToArray(csv: string): string[][] { | |
const table = [] as string[][]; | |
let row = []; | |
let cell = ''; | |
let openQuote = false; | |
let i = 0; | |
const pushCell = () => { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function swap(arr, a, b) { | |
if (a === b) { | |
return; | |
} | |
const temp = arr[a]; | |
arr[a] = arr[b]; | |
arr[b] = temp; | |
} | |
let loops = []; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Ember from 'ember'; | |
export default Ember.Controller.extend({ | |
now: null, | |
observerNow: null, | |
_observerNow: Ember.observer('now', function() { | |
this.set('observerNow', this.get('now')); | |
}), | |
tick() { | |
Ember.run.later(this, function() { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Ember from 'ember'; | |
export default Ember.Controller.extend({ | |
appName: 'Ember Twiddle', | |
length: 6, | |
originalVal: '', | |
arrayVal: Ember.computed('originalVal', function() { | |
const origin = this.get('originalVal').toString(); | |
const len = this.get('length'); | |
let arr = new Array(len); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export function htmlEscape(content) { | |
[ | |
{origin: '&', escaped: '&'}, | |
{origin: '<', escaped: '<'}, | |
{origin: '>', escaped: '>'} | |
].forEach(pair => content = content.replace(new RegExp(pair.origin, 'g'), pair.escaped)); | |
return content; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$('.chart').each(function() { | |
var $this = $(this); | |
var lineWidth = 15, | |
indicatorHeight = 20, | |
scaleLength = indicatorHeight - lineWidth; | |
var canvasWidth = $this.width(); | |
var rOutter = canvasWidth / 2 - scaleLength, | |
rInner = rOutter - lineWidth - 3; | |
var rotate = -90; | |