A collection of peer-to-peer decentralized projects. Contact me to add your project!
More project can be found here: https://www.gnunet.org/links/
defmodule Config do | |
@moduledoc """ | |
This module handles fetching values from the config with some additional niceties | |
""" | |
@doc """ | |
Fetches a value from the config, or from the environment if {:system, "VAR"} | |
is provided. | |
An optional default value can be provided if desired. |
Pry.config.editor = "vim --noplugin" | |
if defined?(PryByebug) | |
Pry.commands.alias_command 'c', 'continue' | |
Pry.commands.alias_command 's', 'step' | |
Pry.commands.alias_command 'n', 'next' | |
Pry.commands.alias_command 'f', 'finish' | |
Pry.commands.alias_command 'b', 'break' | |
Pry.commands.alias_command 'bda', 'break --disable-all' | |
end |
-- show running queries (pre 9.2) | |
SELECT procpid, age(query_start, clock_timestamp()), usename, current_query | |
FROM pg_stat_activity | |
WHERE current_query != '<IDLE>' AND current_query NOT ILIKE '%pg_stat_activity%' | |
ORDER BY query_start desc; | |
-- show running queries (9.2) | |
SELECT pid, age(query_start, clock_timestamp()), usename, query | |
FROM pg_stat_activity | |
WHERE query != '<IDLE>' AND query NOT ILIKE '%pg_stat_activity%' |
res = | |
with {:ok} <- validate_request(request), | |
{:ok, user} <- get_user(request), | |
{:ok} <- update_db(user), | |
{:ok} <- send_email(user) do | |
return_http_message | |
end | |
case res do | |
{:error, x} -> IO.inspect("Error: " <> x) |
A collection of peer-to-peer decentralized projects. Contact me to add your project!
More project can be found here: https://www.gnunet.org/links/
go build -gcflags '-N' |
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... |
I'm hunting for the best solution on how to handle keeping large sets of DB records "sorted" in a performant manner.
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
#load "HyperF.fsx" | |
open HyperF | |
open Route | |
let service = | |
[ | |
Get("/resource/:id") => fun (req,ri) -> "hello world!" |> HttpRes.plainText |
/* ============================================================= | |
* bootstrap-typeahead.js v2.2.2 | |
* http://twitter.github.com/bootstrap/javascript.html#typeahead | |
* ============================================================= | |
* Copyright 2012 Twitter, Inc. | |
* | |
* Licensed under the Apache License, Version 2.0 (the "License"); | |
* you may not use this file except in compliance with the License. | |
* You may obtain a copy of the License at | |
* |