Skip to content

Instantly share code, notes, and snippets.

SET FOREIGN_KEY_CHECKS=0;
##############################
# SALES TABELLEN
##############################
TRUNCATE `sales_flat_creditmemo`;
TRUNCATE `sales_flat_creditmemo_comment`;
TRUNCATE `sales_flat_creditmemo_grid`;
TRUNCATE `sales_flat_creditmemo_item`;
TRUNCATE `sales_flat_invoice`;
@nickschot
nickschot / application.js
Last active August 29, 2015 14:25
JSON API serializer for Ember to make ID's generated by FortuneJS URL safe
import DS from 'ember-data';
export default DS.JSONAPISerializer.extend({
serializeIdFunc: decodeURIComponent,
normalizeIdFunc: encodeURIComponent,
/*
@method normalize
@param {DS.Model} modelClass
@param {Object} resourceHash
@nickschot
nickschot / PowerlineSymbols.otf
Last active August 29, 2015 14:27 — forked from evanpurkhiser/PowerlineSymbols.otf
Monaco Powerline fixed
@nickschot
nickschot / infinity-route-jsonapi.js
Created January 8, 2017 14:28
(Somewhat) Crude extension of the route included in ember-infinity to work correctly together with JSONAPI.
import Ember from 'ember';
import InfinityRoute from "ember-infinity/mixins/route";
export default Ember.Mixin.create(InfinityRoute, {
perPageParam : "page[size]",
pageParam : "page[number]",
totalPagesParam : "meta.total",//unused
/**
@method _nextPageLoaded
@nickschot
nickschot / jwt.js
Last active January 17, 2017 19:57
Modified ember-simple-auth-token JWT authenticator suitable for Lux
import Ember from 'ember';
import JWT from 'ember-simple-auth-token/authenticators/jwt';
const assign = Ember.assign || Ember.merge;
export default JWT.extend({
/**
Accepts a `url` and `data` to be used in an ajax server request.
@method makeRequest
@private
@nickschot
nickschot / lux-postgres-search.js
Last active June 14, 2017 23:21
Lux + Postgres search middleware
/*
This middleware is to be used in the controller beforeAction hook.
You can search text, int and multi-column.
Example use in a controller:
query = ['search'];
beforeAction = [
search(MyModel, {
searchText: ['description'],
@nickschot
nickschot / lux-restrict-access.js
Last active March 21, 2017 14:32
Lux action level permission middleware test + example
// app/middleware/restrict-access.js
import User from 'app/models/user';
import Employee from 'app/models/employee';
import {UserTypes} from 'app/utils/constants';
/**
* Options contains action's as key names and callback functions as values
* Callback receives request, response and a user object as arguments
* @param options
@nickschot
nickschot / lux-redis.js
Last active April 27, 2017 18:39
Lux + Redis Middleware
// app/utils/redis.js
import { createClient } from 'then-redis';
export default createClient(process.env.REDIS_URL);
// app/middleware/redis.js
import redis from 'app/utils/redis';
/**
* Middleware to automatically cache routes to Redis.
@nickschot
nickschot / controllers.application.js
Last active December 18, 2017 10:48
Ember-animated scroll reproduction
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle'
});
@nickschot
nickschot / controllers.application.js
Last active July 2, 2018 18:56
Setting relationships
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle',
author1: null,
author2: null,
init(){
this._super(...arguments);