Skip to content

Instantly share code, notes, and snippets.

module Dnd (..) where
import Html exposing (..)
import Html.Attributes exposing (..)
import Html.Events exposing (..)
import StartApp.Simple exposing (start)
import Signal exposing (message, Address)
import Json.Decode
@jasonzoladz
jasonzoladz / Main.elm
Last active January 22, 2016 15:08
Client-side Routing in Elm Using Parser Combinators
module Main where
import Combine exposing (Parser, string, parse, end, andThen, many1, while, many, skip, Result (..))
import Combine.Char exposing (noneOf, char)
import Combine.Num exposing (int)
import Combine.Infix exposing ((<$>), (<$), (<*), (*>), (<*>), (<|>))
import Maybe exposing (Maybe)
import History exposing (path, setPath)
import Signal exposing (Signal, (<~), (~), send, message)
import Effects exposing (Effects, task)
@lamenath
lamenath / allfragments.json
Last active November 29, 2016 18:33
all prismic fragments document mask
{
"Basic Types" : {
"uid" : {
"type" : "UID",
"config" : {
"placeholder" : "Unique Document Identifier"
}
},
"text" : {
"type" : "Text",
(defvar workgroups2-packages
'(
workgroups2
)
"List of all packages to install and/or initialize. Built-in packages
which require an initialization must be listed explicitly in the list.")
(defun workgroups2/init-workgroups2 ()
(use-package workgroups2
:init
@ornicar
ornicar / Pow - the hairy way.md
Last active December 27, 2015 17:39
Pow (http://pow.cx/) functionality for Linux & nginx.

Create required dirs:

mkdir ~/.pow # where play will register the http.port
mkdir ~/.nginx-sites # where pow will create proxy configs

Tell nginx to load sites config from your ~/.nginx-sites by adding this to /etc/nginx.conf:

@evgenius
evgenius / onchange.sh
Last active December 15, 2018 22:17 — forked from senko/onchange.sh
#!/bin/bash
#
# Watch current directory (recursively) for file changes, and execute
# a command when a file or directory is created, modified or deleted.
#
# Written by: Senko Rasic <senko.rasic@dobarkod.hr>
#
# Requires Linux, bash and inotifywait (from inotify-tools package).
#
# To avoid executing the command multiple times when a sequence of
@cpuguy83
cpuguy83 / mongoid_conn_pool.rb
Last active December 19, 2015 11:09
Working out connection pooling for Mongoid. Right now in Mongoid every thread gets a new connection, and is not closing those connections when the thread is complete.
require 'thread'
require 'thread_safe'
require 'monitor'
module Mongoid
def with_session(&block)
Sessions.with_session(&block)
end
module Config
option :session_pool_size, :default => 5
@ayosec
ayosec / CORSDirectives.scala
Created December 18, 2012 03:28
CORS with Spray
package foo.bar
import spray.routing._
import spray.http._
import spray.http.StatusCodes.Forbidden
// See https://developer.mozilla.org/en-US/docs/HTTP/Access_control_CORS
case class Origin(origin: String) extends HttpHeader {
require 'queue'
# Simplified version of the pooling from datamapper's data_objects.
# https://github.com/datamapper/do/blob/master/data_objects/lib/data_objects/pooling.rb
class Moped::Session
class << self
alias new __new
end
@__pool_lock = Mutex.new
require 'queue'
module Rack
module Mongoid
module Middleware
class Sessions
def initialize(app)
@app = app
@sessions = Queue.new