Skip to content

Instantly share code, notes, and snippets.

View fsmanuel's full-sized avatar

Manuel Wiedenmann fsmanuel

View GitHub Profile
@fsmanuel
fsmanuel / conda-deployment.1.setup.sh
Last active March 31, 2019 18:40
Simple Python deployments with Miniconda
# One time setup
# Install Miniconda
wget -O src/miniconda.sh https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh
bash src/miniconda.sh -b -p $HOME/miniconda
export PATH="$HOME/miniconda/bin:$PATH"
# Get the source
git clone https://github.com/datasciencejob-de/data-science-python-setup.git .
# conda env create|update -f environment.yml
name: data-science-project
dependencies:
- python=3.7
- pip=19.0.*
- pip:
- '--editable=.'
- flake8==3.7.*
- flake8-quotes==1.0.*
- jupyter==1.0.*
@fsmanuel
fsmanuel / mirage.config.js
Created March 24, 2017 16:05
Mirage queryParams support (JSON:API filter, page and sort)
function applyQueryParams(collection, queryParams) {
let qp = {
filter: {},
page: {},
sort: ''
};
Object.keys(queryParams)
.reduce((data, key) => {
let matches = key.match(/(.*)\[(.*)\]$/);
@fsmanuel
fsmanuel / components.drop-down.js
Last active December 23, 2016 18:43
Ember readsWithDefault CP
import Ember from 'ember';
const {
getWithDefault,
computed
} = Ember;
function readsWithDefault(dependentKey, defaultValue) {
return computed(dependentKey, {
get() {
@fsmanuel
fsmanuel / patch-input-type-date.js
Created November 27, 2016 13:20
Ember: Patch input type='date'
import Ember from 'ember';
export function initialize() {
// TODO: remove me https://github.com/tildeio/htmlbars/issues/472
let proto = Ember.HTMLBars.DOMHelper.prototype;
proto.setPropertyStrict = function (element, name, value) {
if (value === undefined) {
value = null;
}
@fsmanuel
fsmanuel / example-usage.hbs
Last active November 3, 2016 19:57
Ember JSONAPI pagination
{{paginate-collection model page}}
{{! your list}}
{{paginate-collection model page}}
@fsmanuel
fsmanuel / application.controller.js
Created February 2, 2016 00:32
HasMany get lost
import Ember from 'ember';
export default Ember.Controller.extend({
appName:'Ember Twiddle',
actions: {
add() {
console.log('add');
let provider = this.get('model.firstObject');
let item = { name: 'Feature X', provider: provider };
@fsmanuel
fsmanuel / controller.js
Last active August 29, 2015 14:05
component
Ember.ObjectController.create({
createMarker: function() {
var marker = new InfoBox();
var markerView = this.get('container').lookup('component:custom-marker');
markerView.append();
markerView.set('controller', Ember.ObjectController.create({
marker: marker,
settingIcon: settingIcon,
$ npm install
npm http GET https://registry.npmjs.org/bower
npm http GET https://registry.npmjs.org/grunt-contrib-copy
npm http GET https://registry.npmjs.org/grunt
npm http GET https://registry.npmjs.org/grunt-contrib-watch
npm http GET https://registry.npmjs.org/load-grunt-config
npm http GET https://registry.npmjs.org/grunt-contrib-concat
npm http GET https://registry.npmjs.org/grunt-contrib-clean
npm http GET https://registry.npmjs.org/grunt-contrib-jshint
npm http GET https://registry.npmjs.org/grunt-cli
module KingForm
# Method for building forms that contain fields for associated models.
module NestedFormHelper
# Renders the form for nested objects defined via activerecord accepts_nested_attributes_for
#
# The associated argument can be either an object, or a collection of objects to be rendered.
#
# An options hash can be specified to override the default behaviors.