Skip to content

Instantly share code, notes, and snippets.

Stefan Fochler iStefo

  • Munich, Germany
Block or report user

Report or block iStefo

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@iStefo
iStefo / countAndUpdateUI.swift
Last active Apr 28, 2018 — forked from jasonyunjoonpark/countAndUpdateUI.swift
completion handler for a function that takes a parameter
View countAndUpdateUI.swift
import UIKit
class ViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
DispatchQueue.global(qos: .userInteractive).async {
//Background thread
View components.my-component.js
import Ember from 'ember';
export default Ember.Component.extend({
totalLength: Ember.computed('data.@each.name', function() {
// doesn't matter, won't compute anyway
return -1;
})
});
View components.my-component.js
import Ember from 'ember';
export default Ember.Component.extend({
totalLength: Ember.computed('data.@each.name', function() {
// doesn't matter, won't compute anyway
return -1;
})
});
@iStefo
iStefo / History.ex
Last active Jul 21, 2016
Learning Elixir: Transaction History Properties
View History.ex
defmodule History do
@type op :: {ta(), cmd(), data()}
@type ta :: any()
@type cmd :: :read | :write | :commit | :abort
@type data :: any()
@doc """
Parses a textual representation of a history into a list of operation tuples.
## Examples
@iStefo
iStefo / escapeExpression.js
Created Mar 19, 2015
Handlebars escapeExpression for Spacebars
View escapeExpression.js
/*
escapeExpression inserted into the Spacebars namespace, taken from
https://github.com/wycats/handlebars.js/blob/master/lib/handlebars/utils.js
*/
var escape = {
"&": "&",
"<": "&lt;",
">": "&gt;",
'"': "&quot;",
View model-dep-qp.md

"Model-dependent query param stickiness"

The question of whether query param controller properties are preserved/restored/reset when navigating away/back/between routes is a tricky one, but the sensible default seems to be "model-dependent stickiness", whereby query params are stick unless you're switching the model of the current or parent routes. There's more that could be said about this but here's a quick summary of my plan:

  • We need a dictionary to store QP state scoped to a model
@iStefo
iStefo / gist:9267640
Created Feb 28, 2014
my thoughts on query-params-new
View gist:9267640

These are my thoughts on using the (bleeding edge) query-params-new from 1.6.0-beta.1+canary.01f3f32c.

1. Numerical Parameters

The currently handled parameter types are strings (of course), arrays (with the arr[]=foo1&arr[]=foo2 syntax, which is not the nicest but closest zu the standard) and booleans. The absence of integer parameters means having to use parseInt() in every method where the parameter is used. (Setting the parameter to a number value is no problem)

I think there are two ways to determine whether to cast or not while parsing parameters:

  1. Check if param contains only digits and just assume that it's meant to be a numeric parameter then. Since this may cause unforeseen behaviour we shouldn't do this
  2. Add a descriptior to the controllers queryParams to force a query parameters data type (this would also allow providing an array when the present url is arr=foo1 without the [], but I'm not sure if this is a desirable thing)
@iStefo
iStefo / ember-meta.js
Created Apr 29, 2013
Ember-Meta module. See first comment for usage etc.!
View ember-meta.js
// include this code in your application, you don't need to call any initialization manually!
Ember.Application.initializer({
name: "meta",
initialize: function(container, application) {
// helper function to get tag from dom
var _getTag = function(tagname, property, value) {
var tags = document.head.getElementsByTagName(tagname),
tag,
You can’t perform that action at this time.