Skip to content

Instantly share code, notes, and snippets.

View schovi's full-sized avatar
👁️

David Schovanec schovi

👁️
View GitHub Profile
@schovi
schovi / gist:665326
Created November 6, 2010 10:19
Rail3 friendly pagination
# If you are using ActiveRecord and want to paginate it you have to write this:
# PeacefulPaginate.use_for_active_record!
# to end of your config/environment.rb
# If you want to override default .paginate method from WillPaginate gem you have to insert this
# PeacefulPaginate.use_compatible_mod_with_will_paginate!
# to end of your config/environment.rb
# With this you dont have to rewrite nothing else in your application
# In other way how to use it
@puffnfresh
puffnfresh / valueobject.js
Created February 2, 2013 20:07
Automatic creation of constructors.
// TODO: Automatically create a useful isEqual function.
function valueObject() {
var names = arguments;
function wrapped() {
var o = this instanceof wrapped ? this : {}, i;
if(arguments.length != names.length) {
throw new TypeError("Expected " + names.length + " arguments, got " + arguments.length);
}
for(i = 0; i < names.length; i++) {
o[names[i]] = arguments[i];
@puffnfresh
puffnfresh / objectunion.js
Last active December 12, 2015 02:28
Creation of unions, with automatic value constructors and an automatic fold encoding.
// Boilerplate
function objectUnion(definer) {
var defined = 0, length = 0, isDefined = false, definitions, key;
definitions = definer(function() {
var names = arguments, fold;
if(isDefined) {
throw new TypeError('This objectUnion has already been defined');
}
function Ctor() {}
@karmi
karmi / README.markdown
Last active January 9, 2016 17:04
echo 'Přečti mi něco, prosím!' | ruby dictator.rb

A simple dictation robot.

echo 'Přečti mi něco, prosím!' | ruby dictator.rb

cat data.txt | ruby dictator.rb

cat data.txt | SPEED=1.5 ruby dictator.rb
// something like:
<BundleLink to="/profile" onLoadStart={() => {
// throw a spinner up on the "old" page while we load
this.setState({ navigating: true })
}}>Profile</BundleLink>
<BundleLink to="/dash" prefetch={true}>Dashboard</BundleLink>
///////////////////////////////////////////////////////
const BUNDLED_ROUTES = {
@Aldredcz
Aldredcz / lightning-talk-proposal.md
Last active October 13, 2019 22:48
ReactiveConf - Lightning talk - Delightful Drag and Drop for complex interactive UIs

logo

Vojtech Prikryl (@productboard)

Delightful Drag and Drop for complex interactive UIs

Drag and Drop is undoubtedly one of the most popular and user-friendly interactions in software nowadays. There are plenty awesome libraries for DnD in React realm, covering most of the use cases. We tried them all at productboard, but realized we need something special for complex interfaces we are building. We developed our own solution that satisfied three main requirements we had:

  1. Delightful user experience 🤩
  2. Great performance even for large datasets 🏎
  3. Reusability of already existing code 🔌
@kokes
kokes / netflix-cs-audio.txt
Last active November 2, 2019 20:38
Filmy s českýma titulkama na Netflixu
Alexa & Katie
All or Nothing
Angel of the Lord 2
Another Life
Backstage
Barbie Dolphin Magic
Basketball or Nothing
Beats
Black Mirror
Captain Underpants: The First Epic Movie
@echarles
echarles / gist:5813448
Created June 19, 2013 10:53
List of ElasticSearch REST commands (retrieved from source code with grep)
DELETE
DELETE _template/{name}
DELETE {index}
DELETE {index}/_alias/{name}
DELETE {index}/_query
DELETE {index}/_warmer
DELETE {index}/_warmer/{name}
DELETE {index}/{type}
DELETE {index}/{type}/_mapping
DELETE {index}/{type}/_query
@bugcy013
bugcy013 / logstach Examples
Created April 26, 2014 00:09
logstach Examples collection
Example -1
=====================
input {
file {
path => [ "/usr/local/var/log/suricata/eve.json", "/var/log/ulogd.json" ]
codec => json
type => "json-log"
}
}
// create a bookmark and use this code as the URL, you can now toggle the css on/off
// thanks+credit: https://dev.to/gajus/my-favorite-css-hack-32g3
javascript: (function() {
var styleEl = document.getElementById('css-layout-hack');
if (styleEl) {
styleEl.remove();
return;
}
styleEl = document.createElement('style');
styleEl.id = 'css-layout-hack';