Skip to content

Instantly share code, notes, and snippets.

@tkafka
tkafka / _pebble_function_size.sh
Last active October 8, 2016 16:34
Optimizing app size (for aplite): script to show code space size for every function. I noticed that you can read size of every function from build/pebble-app.map. So, here's a script to do it :)).
#!/usr/bin/env bash
cat ./build/pebble-app.map |
# pick important part of file
sed -n -e "/^ \*(\.text\.\*)/,/^ \*(\.rodata)/p" |
# remove first and last line
sed -e "1d" -e "\$d" |
# ensure every function is on single line:
@tkafka
tkafka / LICENSE.txt
Last active September 5, 2019 13:38
Drop-in replacement for ReactCSSTransitionGroup that uses velocity.js instead of CSS transforms. Add your own transitions to `transitions` hash.
The MIT License (MIT)
Copyright (c) 2014 Tomas Kafka
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
@tkafka
tkafka / Hiding pane with native scroll.html
Created October 29, 2014 14:33
Native-like crude touch sliding panel with zepto + velocity.
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<meta name="viewport" content="width=device-width, user-scalable=no" />
<title>scroll and touchmove - jsFiddle demo</title>
<script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/zepto/1.0rc1/zepto.min.js"></script>
<script type="text/javascript" src="//cdn.jsdelivr.net/velocity/1.1.0/velocity.min.js"></script>
<!--
(function($) {
// Add inner and outer width to zepto (adapted from https://gist.github.com/alanhogan/3935463)
var ioDim = function(dimension, includeBorder) {
return function (includeMargin) {
var sides, size, elem;
if (this) {
elem = this;
size = elem[dimension]();
sides = {
width: ["left", "right"],
@tkafka
tkafka / ringbuffer.h
Created December 7, 2013 23:10
OMG, ringbuffer in C macros :)
#include <stdlib.h>
#include <memory.h>
#include <malloc.h>
#ifndef _ringbuffer_h
#define _ringbuffer_h
// semantics: buffer goes from start to end-1, start == end -> empty or full, see 'full' flag
#define ringBuffer_typedef(T, NAME) \
typedef struct { \
@tkafka
tkafka / ui-faces.js
Last active December 15, 2015 02:29
List of avatars from http://uifaces.com by @calebogden - for mocking UIs
var UI_FACES = [
"http://uifaces.com/faces/_twitter/ShaunMoynihan_120.jpg",
"http://uifaces.com/faces/_twitter/blakesimkins_120.jpg",
"http://uifaces.com/faces/_twitter/nckjrvs_120.jpg",
"http://uifaces.com/faces/_twitter/cameronmoll_120.jpg",
"http://uifaces.com/faces/_twitter/timothycd_120.jpg",
"http://uifaces.com/faces/_twitter/jayrobinson_120.jpg",
"http://uifaces.com/faces/_twitter/damenleeturks_120.jpg",
"http://uifaces.com/faces/_twitter/danielhaim_120.jpg",
"http://uifaces.com/faces/_twitter/motherfuton_120.jpg",
@tkafka
tkafka / gist:4610798
Created January 23, 2013 17:40
UXcamp 2013 FB like button - change 'changethis' in url for your nickname/twitter handle (only alphanumeric and '-', no spaces), and paste into HTML widget.
<iframe src="//www.facebook.com/plugins/like.php?href=http%3A%2F%2Fuxcamp.cz%2Fleden2013%2Fchangethis&amp;send=false&amp;layout=standard&amp;width=450&amp;show_faces=true&amp;font&amp;colorscheme=light&amp;action=like&amp;height=80&amp;appId=203153213159064" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:450px; height:80px;" allowTransparency="true"></iframe>
http://www.behance.net/gallery/Facebook-New-Look-Concept/6504647
Good:
+ layouty kalendaru, hlavne horizontalni je zajimavy napad
+ graficke tema
Ugly:
- neni to jak cist kdyz si chci precist vsechno od posledniho checknuti FB, jednoznacny je jen linearni obsah ala super.cz (zejmena activity feed se dvema nezavislymi sloupci, budu nervozne tekat mezi atraktivnimi fotkami)
- prilis atraktivni fotky, text vypada nudne a nikdo by ho necetl
- schovane menu vpravo je clever, ne obvious
@tkafka
tkafka / .htaccess
Created November 5, 2012 20:54
Nette 2 na Wedos
# enable cool URL
<IfModule mod_rewrite.c>
# FastCGI
SetEnv NETTE_HTACCESS ok
</IfModule>
<?php
use Nette\Diagnostics\Debugger,
Nette\Application\Routers\Route,
Nette\Application\Routers\RouteList,
Nette\Application\Routers\SimpleRouter;
// Load Nette Framework
require LIBS_DIR . '/Nette/loader.php';