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
namespace MyApp | |
open Sol.Context | |
module Middlewares = | |
let authenticateAdmin next ctx = | |
let isAdmin = hasQueryParam "is_admin" ctx |
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 "http/server" | |
# from https://github.com/crystal-lang/crystal/pull/7302 | |
class HTTP::Request | |
@io : IO? | |
def initialize(@method : String, @resource : String, headers : Headers? = nil, body : String | Bytes | IO | Nil = nil, @version = "HTTP/1.1", @io : IO? = nil) | |
@headers = headers.try(&.dup) || Headers.new | |
self.body = body |
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
def rand_str(length = 16, supplemental_chars = "") | |
res = [] of Char | |
chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789" + supplemental_chars | |
length.times do { |i| res << chars[rand(chars.size)] } | |
res.join() | |
end | |
rand_str 32 | |
#=> xkURIpYnqbRVj893pr23LhhxeukFTu5f | |
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
# Follow guide here: | |
# https://www.netguru.co/codestories/nginx-tutorial-performance | |
location /api { | |
# proxy here | |
# | |
# Make all proxy request start with a certain path (ie. /api) so they are quicker and | |
# we don't have to see if it matches a static asset. | |
# | |
# so instead of "http://example.com/users/sam" and NGINX checking if there |
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
FROM crystallang/crystal:0.22.0 | |
MAINTAINER [email protected] | |
WORKDIR /app | |
# copy all your app files/directories to image | |
COPY static ./static | |
COPY dev ./dev | |
COPY spec ./spec | |
COPY src ./src | |
COPY shard.yml ./shard.yml |
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
[ | |
{ "keys": [" "], "command": "insert_snippet", "args": {"contents": " $0 "}, "context": [ | |
{ "key": "preceding_text", "operator": "regex_contains", "operand": "(\\(|\\[|{) ?$", "match_all": true }, | |
{ "key": "following_text", "operator": "regex_contains", "operand": "^(\\)|\\]|})", "match_all": true } | |
]}, | |
{ "keys": [" "], "command": "insert_snippet", "args": {"contents": "$0 "}, "context": [ | |
{ "key": "preceding_text", "operator": "regex_contains", "operand": "(\\(|\\[|{) $", "match_all": true }, | |
{ "key": "following_text", "operator": "regex_contains", "operand": "^(\\)|\\]|})", "match_all": true } | |
]} | |
] |
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
Show hidden characters
[ | |
// | |
// TABS (REGULAR) | |
// | |
// Tab set | |
{ | |
"class": "tabset_control", | |
"layer0.texture": "", | |
"layer0.tint": [34,34,34], | |
"layer0.inner_margin": 2, // Overlay light puck (for dark content) |
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(t){function n(e){if(r[e])return r[e].exports;var i=r[e]={exports:{},id:e,loaded:!1};return t[e].call(i.exports,i,i.exports,n),i.loaded=!0,i.exports}var r={};return n.m=t,n.c=r,n.p="",n(0)}([function(t,exports,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}n(1);var e=n(286),i=r(e),o=n(287),u=r(o),a=n(290),c=r(a),f=n(291),s=r(f),l=n(292),p=r(l),h=n(293),v=r(h),g=n(294),d=r(g),y=n(295),_=(r(y),n(296)),m=r(_),b=n(297),w=r(b),x=n(298),S=r(x),j=n(299),O=r(j),E=n(300),A=r(E),k=n(301),F=r(k);(function(){function t(){var t=n();c["default"].each(t,r)}function n(){var t=c["default"].toArray(document.getElementsByClassName("embeddable-q-form"));return c["default"].filter(t,function(t){return!t.dataset.built})}function r(t){function n(){console.log("formContainer: ",t),console.log("formContainer.id: ",t.id),q(t.id,t),setTimeout(function(){r()},400)}function r(){t.classList.remove("hide")}if(!t.dataset.built){t.id=(0,O["default"])("embedable-q-form-"),t.dataset.built=!0,t.classList.add("hide |
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
/* eslint-disable id-blacklist */ | |
/* eslint-disable id-length */ | |
/* eslint-disable no-param-reassign */ | |
/* eslint-disable no-implicit-coercion */ | |
/* eslint-disable no-undefined */ | |
/* eslint-disable no-empty-function */ | |
/* eslint-disable semi */ | |
/* eslint-disable quotes */ | |
/* eslint-disable no-eq-nullg */ |
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
// module.exports = (function(){ | |
var dom = (function(){ | |
var _cache = {}; | |
function cleanCache() { | |
// document.body.contains(x); | |
var htmlDoc = document.getElementsByClassName('html')[0]; | |
Object.keys(_cache).forEach(function(k) { | |
if(!htmlDoc.contains(_cache[k])) |
NewerOlder