Skip to content

Instantly share code, notes, and snippets.

@marciol
marciol / custom_plan.rb
Created October 4, 2013 22:36
Require pry-byebug from outside of bundle with zeus
require 'zeus/rails'
class CustomPlan < Zeus::Rails
# def my_custom_command
# # see https://github.com/burke/zeus/blob/master/docs/ruby/modifying.md
# end
def default_bundle
super
Gem.post_reset_hooks.reject!{ |hook| hook.source_location.first =~ %r{/bundler/} }
@marciol
marciol / app.fsx
Last active August 29, 2015 14:06 — forked from eulerfx/app.fsx
#load "HyperF.fsx"
open HyperF
open Route
let service =
[
Get("/resource/:id") => fun (req,ri) -> "hello world!" |> HttpRes.plainText

I'm hunting for the best solution on how to handle keeping large sets of DB records "sorted" in a performant manner.

Problem Description

Most of us have work on projects at some point where we have needed to have ordered lists of objects. Whether it be a to-do list sorted by priority, or a list of documents that a user can sort in whatever order they want.

A traditional approach for this on a Rails project is to use something like the acts_as_list gem, or something similar. These systems typically add some sort of "postion" or "sort order" column to each record, which is then used when querying out the records in a traditional order by position SQL query.

This approach seems to work fine for smaller datasets, but can be hard to manage on large data sets with hundreds (or thousands) of records needing to be sorted. Changing the sort position of even a single object will require updating every single record in the database that is in the same sort group. This requires potentially thousands of wri

@marciol
marciol / designer.html
Created November 17, 2014 13:33
designer
<link rel="import" href="../google-map/google-map.html">
<link rel="import" href="../google-map/google-map-directions.html">
<link rel="import" href="../google-map/google-map-search.html">
<link rel="import" href="../yt-video/yt-search-video.html">
<link rel="import" href="../smoothie-chart/smoothie-chart.html">
<link rel="import" href="../topeka-elements/category-icons.html">
<link rel="import" href="../core-icon/core-icon.html">
<link rel="import" href="../speech-mic/speech-mic.html">
<polymer-element name="my-element">
@marciol
marciol / Cask
Last active August 29, 2015 14:11
(source "melpa" "http://melpa.milkbox.net/packages/")
(source gnu)
(source marmalade)
(depends-on "auctex")
(depends-on "auto-complete")
(depends-on "cask")
(depends-on "clojure-mode")
(depends-on "coffee-mode")
(depends-on "color-theme")
@marciol
marciol / init.el
Last active August 29, 2015 14:11
(require 'cask "~/.cask/cask.el")
(cask-initialize)
(require 'pallet)
(pallet-mode t)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; APPEARANCE CUSTOMIZATIONS ;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Startup
package controllers
import env.Env
import play.api.libs.json.JsArray
import play.api.mvc._
import play.api.libs.concurrent.Execution.Implicits._
// here's where the injection takes place
class Application(env: Env) extends Controller {
import env._ // to avoid writing something like env.WS.url() or env.configuration.get...
@marciol
marciol / build.sh
Last active August 29, 2015 14:25 — forked from cevaris/build.sh
Debugging golang in GDB
go build -gcflags '-N'
// Example of how to use stdlib in go, leveraging the simplicity of solutions without dependencies
// based on https://www.youtube.com/watch?v=yi5A3cK1LNA&feature=youtu.be&t=11m45s
func productHandler(w http.ResponseWriter, r *http.Request) {
key := r.URL.PATH[len("/products/"):]
switch r.Method {
case "GET":
// do get stuff
case "POST":
// do post stuff
@marciol
marciol / p2p-list.md
Created February 3, 2016 19:45 — forked from moshest/p2p-list.md
A collection of peer-to-peer decentralized projects.