Skip to content

Instantly share code, notes, and snippets.

import Ember from 'ember';
const {
Component,
on,
computed,
A: EArray,
} = Ember;
export default Component.extend({
@n1ru4l
n1ru4l / components.some-component.js
Last active May 23, 2017 16:04
array not updating
import Ember from 'ember';
import {
times,
constant
} from 'lodash';
const {
get,
set,
Component,
@n1ru4l
n1ru4l / components.query-wrapper.js
Last active May 18, 2017 05:47
Ember Graphql Query Component
import Ember from 'ember';
import gql from 'graphql-tag'
const query = gql`
query pokedex {
pokedex {
pokemon(start: 0 number: 10) {edges {node {id name}}}
}
}
`
@n1ru4l
n1ru4l / ArtistList.js
Created January 24, 2017 15:42
mobx + apollo-client + react
import React from 'react'
import { observer } from 'mobx-react'
function ArtistList({ uiState: { artistData } }) {
const { data } = artistData;
if ( !data || !data.artists || !data.artists.length ) {
return <div>No artists bruh.</div>
}
const { artists } = data
return (
@n1ru4l
n1ru4l / esnextbin.md
Last active July 13, 2016 08:11
esnextbin sketch
@n1ru4l
n1ru4l / parseDuration.js
Created June 18, 2016 12:50
Convert mediainfo duration to seconds
function parseDuration(duration) {
let durationInSeconds = 0
const hourIndex = duration.indexOf('h')
if(hourIndex > -1) {
let hours = parseInt(duration.substr(0, hourIndex), 10)
duration = duration.substr(hourIndex + 1)
durationInSeconds += hours * 60 * 60
}