Skip to content

Instantly share code, notes, and snippets.

@denyskoch
denyskoch / debouce.swift
Last active August 26, 2018 09:43
simple debouncing in swift4
import Foundation
typealias Function = () -> ()
typealias FunctionWrapper = (@escaping Function) -> ()
func debounced(time: TimeInterval, callback: @escaping Function) -> Function {
weak var timer: Timer?
return {
timer?.invalidate()
@denyskoch
denyskoch / ViewController.swift
Last active May 2, 2016 16:32
UIBlurEffect for underlaying view. NEED: presentation: Over Current Context
override func viewDidLoad() {
super.viewDidLoad()
let visuaEffectView = UIVisualEffectView(effect: UIBlurEffect(style: .Light))
visuaEffectView.frame = view.bounds
view.backgroundColor = UIColor.clearColor()
view.opaque = false
view.insertSubview(visuaEffectView, atIndex: 0)
}
@denyskoch
denyskoch / filter-helper.js
Created July 26, 2015 11:15
Handlebars block helper for filtering arrays by a path.
function filterHelper(context, options) {
if (!options || !options.hash.where) {
throw new Exception('Must pass <where> and <is> | <isnot> to #filter');
}
if (Handlebars.Utils.isFunction(context)) {
context = context.call(this);
}
if (options.data) {
@denyskoch
denyskoch / select_fix.scss
Created August 4, 2014 12:05
Fix for not useable custom form selects on mobile/touch devices in Foundation 4. With this fix, the user has the native UI/UX for selects.
.touch form.custom select.hidden-field {
height: $custom-select-height;
margin-left: 0;
visibility: visible;
z-index: 20;
background: #fff;
padding: 0;
border: 0;
opacity: 0;
@denyskoch
denyskoch / DataViewHelper.php
Created February 28, 2014 09:42
ViewHelper for merging only if one path is not set ...
<?php
/**
* Converts raw flexform xml into an associative array
*
*/
class Tx_SomeExt_ViewHelpers_DataViewHelper extends Tx_Fluid_Core_ViewHelper_AbstractViewHelper {
/**
* @var array
*/
@denyskoch
denyskoch / default.html
Created February 19, 2014 13:27
Strange behavior of "{var}" != {var}
{namespace v=Tx_Vhs_ViewHelpers}
{namespace flux=Tx_Flux_ViewHelpers}
<f:layout name="Page" />
<f:section name="Configuration">
<flux:flexform id="defaultpage" icon="ext_icon.gif">
<flux:flexform.sheet name="logos">
<flux:flexform.section name="logos">
<flux:flexform.object name="logo">
<flux:flexform.field.input name="alt" required="true" />
@denyskoch
denyskoch / footer partial not woking.html
Last active August 29, 2015 13:56
Strange menu rendering behavior...
@denyskoch
denyskoch / Plane.cpp
Created February 7, 2014 17:13
Ray Tracing
bool
Plane::
intersect(const Ray& _ray,
vec3& _intersection_point,
vec3& _intersection_normal,
double& _intersection_t ) const
{
double dpDN = dot(_ray.direction, this->normal);
if( dpDN == 0)
@denyskoch
denyskoch / FlexForms.html
Last active August 29, 2015 13:56
Clean way of FlexForm separation.
{namespace v=Tx_Vhs_ViewHelpers}
{namespace flux=Tx_Flux_ViewHelpers}
<f:section name="Logos">
<flux:flexform.sheet name="logos">
<flux:flexform.section name="logos">
<flux:flexform.object name="logo">
<flux:flexform.field.input name="alt" required="true" />
<flux:flexform.field.file name="src" allowed="png" required="true" />
</flux:flexform.object>
@denyskoch
denyskoch / 1. first try, what is wanted....html
Last active August 29, 2015 13:56
incomplete Flux implementation. Should be fixed in upcomming 6.2 LTS
<f:section name="Configuration">
<flux:flexform id="defaultpage" icon="EXT:lia_relaunch_de/ext_icon.gif">
<flux:flexform.sheet name="logos">
<flux:flexform.section name="logos">
<flux:flexform.object name="logo">
<flux:flexform.field.input name="alt" required="true" />
<flux:flexform.field.file name="src" allowed="png" required="true" />
</flux:flexform.object>
</flux:flexform.section>
</flux:flexform.sheet>