Skip to content

Instantly share code, notes, and snippets.

View krtek's full-sized avatar

Lukáš Marek krtek

  • Praha
  • 11:48 (UTC +02:00)
View GitHub Profile
@krtek
krtek / controllers.coffee
Last active August 24, 2017 21:47
Simple Angular.js filter to search in array of items.
app.controller 'ListController', ($scope, $filter) ->
$scope.search = {}
$scope.all_data = [
{title: 'Three men on the bummel', 'author': 'Jerome Klapka Jerome', meta: {isbn: 2234}}
{title: 'Three men on a boat', 'author': 'Jerome Klapka Jerome', meta: {isbn: 1234}}
{title: 'Three musketeers', 'author': 'Alexandre Dumas', meta: {isbn: 4566}}
{title: 'Four tank men and a dog', 'author': 'Janusz Przymanowsky', meta: {isbn: 1222}}
]
$scope.$watch("search.query", ( ->
@krtek
krtek / __init__.py
Last active December 25, 2015 14:59
Secure access to AppEngine application with webapp2.
from utils import SecureApplication
routes = (
('/route1', 'app.views.view1'),
)
handler = SecureApplication(routes=routes, debug=settings['DEBUG'])
@krtek
krtek / gist:4991591
Created February 20, 2013 00:23
ZT - Unicorn puzzle solution
public class MagicalLand {
public static void main(String[] args) {
for (int i = 0; i < (Math.random() * 500) + 2; i++) {
if (Unicorn.pat()) {
System.out.println("UNICORN #1: PAT THIS UNICORN ONCE");
}
}
for (int i = 0; i < (Math.random() * 500) + 2; i++) {
if (Unicorn.pat()) {