Skip to content

Instantly share code, notes, and snippets.

@n1ru4l
n1ru4l / esnextbin.md
Last active July 13, 2016 08:11
esnextbin sketch
@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 / 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,
import Ember from 'ember';
const {
Component,
on,
computed,
A: EArray,
} = Ember;
export default Component.extend({
@n1ru4l
n1ru4l / controllers.application.js
Created June 10, 2017 13:41
onChange event demonstartion
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle',
model: {
sumText: 'sum text',
},
actions: {
changed() {
alert('onChange triggered')
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle',
actions: {
foo() {
alert('red box')
},
bar(ev) {
@n1ru4l
n1ru4l / EventServiceProvider.php
Created July 31, 2017 13:27
Laravel realpath_cache clearing
<?php
namespace App\Providers;
use Illuminate\Support\Facades\Event;
use Illuminate\Foundation\Support\Providers\EventServiceProvider as ServiceProvider;
class EventServiceProvider extends ServiceProvider
{
@n1ru4l
n1ru4l / components.lq-select.js
Last active September 14, 2017 16:42
IT STILL WORKS
import Ember from 'ember'
const { Component } = Ember
export default Component.extend({
// props
availableItems: undefined,
selectedItem: undefined,
onSelectItem: undefined,
})
@n1ru4l
n1ru4l / components.lq-select.js
Last active September 21, 2017 18:08
New Twiddle
import Ember from 'ember'
const { Component } = Ember
export default Component.extend({
// properties
options: undefined,
selectedOption: undefined,
onChange: undefined,
})
@n1ru4l
n1ru4l / helpers.js
Created September 26, 2017 08:18
Tiny Flow Helpers
export const once = (func: Function): Function => {
let called = false
let cachedValue = undefined
return (...args) => {
if (!called) {
cachedValue = func(...args)
called = true
}
return cachedValue
}