This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{-# LANGUAGE RankNTypes #-} | |
{-# LANGUAGE TupleSections #-} | |
module Poptics where | |
import Prelude hiding (traverse) | |
import Control.Category ((>>>)) | |
import Control.Applicative (liftA2, Const (..)) | |
import Control.Arrow ((&&&), (|||), (***)) | |
newtype State s a = State { run :: s -> (a,s)} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- :name insert-or-get-image! :<! :1 | |
/* :doc insert an image, or retrieve existing, and return the id, uri, and | |
public URL as determined by the provided `:bucket` and `:images-host`. | |
*/ | |
WITH new_img AS ( | |
INSERT INTO image (uri, fmt, size, device_id, os_version_id) | |
VALUES (:uri, :fmt, :size, :device-id, :os-version-id) | |
ON CONFLICT (uri) DO NOTHING | |
RETURNING id, uri, | |
gcs_uri_to_public_url(uri, COALESCE(:bucket, ''), COALESCE(:images-host, '')) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Loosely based on https://www.fpcomplete.com/blog/2017/12/building-haskell-apps-with-docker | |
FROM fpco/stack-build:lts-13.27 as dependencies | |
RUN mkdir /opt/build | |
WORKDIR /opt/build | |
# GHC dynamically links its compilation targets to lib gmp | |
RUN apt-get update \ | |
&& apt-get download libgmp10 | |
RUN mv libgmp*.deb libgmp.deb |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CREATE TEMPORARY TABLE boxes_to_restore | |
(rebillable_id int(10) unsigned, | |
bh_id int(10) unsigned, | |
billing_frequency tinyint(3) unsigned, | |
prev_cycle_status int(10) unsigned, | |
unique index (rebillable_id), | |
unique index (bh_id)); | |
INSERT INTO boxes_to_restore (rebillable_id, bh_id, billing_frequency, prev_cycle_status) | |
SELECT rs.rebillable_id as rebillable_id, bh2.id as bh_id, rs.billing_frequency as billing_frequency, COALESCE(SUM(ctl.result='success')*100 - SUM(ctl.result='failure'),0) as prev_cycle_status |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
syntax on | |
autocmd Filetype html setlocal ts=2 sw=2 expandtab | |
autocmd Filetype ruby setlocal ts=2 sw=2 expandtab | |
autocmd Filetype javascript setlocal ts=2 sw=2 expandtab | |
autocmd Filetype cucumber setlocal ts=2 sw=2 expandtab | |
set noswapfile | |
au BufRead,BufNewFile *.md set filetype=markdown | |
au BufRead,BufNewFile *.md.html set filetype=markdown |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function activarFormulario(){ | |
var form = document.querySelector("form"); | |
form.addEventListener("submit", function(event) { | |
event.preventDefault(); | |
var r = document.getElementById("result"); | |
var n = document.getElementById("GET-nombre"); | |
r.textContent = n.value; | |
}); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Dog < Animal | |
def pet | |
dog_petter.pet | |
end | |
private | |
def dog_petter | |
DogPetter.new | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#config/application.rb | |
config.middleware.use "Peekaboo" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
gem 'sinatra' | |
gem 'rest-client' | |
gem 'json' #probablemente innecesaria |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'gherkin/parser/parser' | |
require 'gherkin/formatter/json_formatter' | |
#This is intended to be mounted on top of a rails app with | |
#mount FakeEndpoints => "/fake_api" | |
#this allows clients to play around with an intended implementation of the API without it being actually coded at all | |
#the features look like | |
# Given I GET /an/endpoint; Then the JSON response is: | |
class FakeEndpoints | |
def initialize | |
@routes = gather_routes |
NewerOlder