Skip to content

Instantly share code, notes, and snippets.

View Idered's full-sized avatar
📸
Working on chalk.ist

Kasper Mikiewicz Idered

📸
Working on chalk.ist
View GitHub Profile
@oszbart
oszbart / FT2014_slides
Last active August 29, 2015 14:01
Front-Trends 2014 slides
Day 1
Julian Cheal
Dancing with Robots
?
Tero Parviainen
Build Your Own AngularJS
?
@danprince
danprince / index.html
Last active August 29, 2015 14:25
Tile Memory Test
<!DOCTYPE html>
<html>
<head>
<!-- Object Format Tests -->
<script src='tiles.js'></script>
<!-- Binary Format Tests -->
<!--<script src='tiles-binary.js'></script>-->
</head>
<body>
</body>
@kvz
kvz / install_wkhtmltopdf.sh
Created September 14, 2011 14:58
Installing wkhtmltopdf as static is faster & dependency free
arch=i386
uname -m |grep 64 && arch=amd64
[ -d /usr/local/bin/ ] || mkdir -p /usr/local/bin/
wget -O /usr/local/bin/wkhtmltopdf.tar.bz2 http://wkhtmltopdf.googlecode.com/files/wkhtmltopdf-0.9.9-static-${arch}.tar.bz2
cd /usr/local/bin/
tar jxvf /usr/local/bin/wkhtmltopdf.tar.bz2
mv wkhtmltopdf-${arch} wkhtmltopdf
chmod 755 wkhtmltopdf
cd -
wkhtmltopdf --help && echo "You're welcome Carl"
@developit
developit / _delegated-component.md
Last active October 20, 2016 21:39
DelegatedComponent

Experiment: Backbone-style events in Preact

What if we wanted to use backbone-style event delegation within the component paradigm afforded by react/preact/etc? Would that be useful?

Example

Basic usage:

@chriddyp
chriddyp / GeomtryCollection.json
Created September 2, 2016 01:08
Simple GeoJSON files
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@Demkeys
Demkeys / GridSnapper.cs
Last active October 24, 2018 11:33
Simple Grid Snapper script to show how the Grid component can be used to align GameObjects along the cells of a Grid.
/// <summary>
/// - Make sure you have a Grid GameObject (any GameObject with a Grid component attached to it) in the scene.
/// - Attach this script to the GameObject you wanna snap to the Grid. Then drag and drop the Grid
/// GameObject into the AttachedGrid field to create a reference to the Grid component attached to it.
/// - Enter Play Mode, and then every time you hit the Space key, this GameObject will move 1 unit
/// down along the Y axis, while remaining snapped to the Grid.
/// </summary>
using System.Collections;
using System.Collections.Generic;
<?php
//////////////////////////////////
// Reddit "hot" story algorithm //
//////////////////////////////////
function hot($ups, $downs, $date)
{
if (is_string($date)) $date = strtotime($date);
$s = $ups - $downs;
/* @flow */
type Result<T> = {
result: boolean,
payload: T
}
type Conditional<T> = {
type: 'conditional',
exec(T): Result<T>
@developit
developit / async-examples.js
Last active February 19, 2020 00:43
Async Array utilities in async/await. Now available as an npm package: https://github.com/developit/asyncro
/** Async version of Array.prototype.reduce()
* await reduce(['/foo', '/bar', '/baz'], async (acc, v) => {
* acc[v] = await (await fetch(v)).json();
* return acc;
* }, {});
*/
export async function reduce(arr, fn, val, pure) {
for (let i=0; i<arr.length; i++) {
let v = await fn(val, arr[i], i, arr);
if (pure!==false) val = v;
/*!
* jQuery Tiny Pub/Sub - v0.X - 11/18/2010
* http://benalman.com/
*
* Original Copyright (c) 2010 "Cowboy" Ben Alman
* Dual licensed under the MIT and GPL licenses.
* http://benalman.com/about/license/
*
* Made awesome by Rick Waldron
*