Skip to content

Instantly share code, notes, and snippets.

View danielr18's full-sized avatar
🏠
Working from home

Daniel Reinoso danielr18

🏠
Working from home
View GitHub Profile
#!/bin/bash
# Config
SITE=$1 #back.example.com
PHP_SOCKET_FILE=$2 #=/run/php/php7.4-...
CACHE_VALID_TIME="${3:-1m}" # Queries remain in cache for 1 minute
REQUEST_LIMIT_SECOND="${4:-4}" # Up to 4 queries per second
MAX_QUEUED_REQUESTS="${5:-200}" # Up to 200 queries in queue
# Nginx Before configs
(function(factory){
if(typeof define==='function'&&define.amd){
define(['jquery'],factory);
}else if(typeof module==='object'&&module.exports){
module.exports=factory(require('jquery'));
}else{
factory(window.jQuery);
}
}
(function($){
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "ServerlessPolicy",
"Effect": "Allow",
"Action": [
"iam:GetRole",
"iam:PassRole",
"iam:CreateRole",
@danielr18
danielr18 / absolute.js
Created December 8, 2018 04:06
Absolute URL from req
import url from 'url'
const defaultValidHostRegex = /www\.example\.com/
export function getProtocol(req) {
let proto = req.connection.encrypted ? 'https' : 'http'
// only do this if you trust the proxy
proto = req.headers['x-forwarded-proto'] || proto
return proto.split(/\s*,\s*/)[0]
}
@danielr18
danielr18 / Responsive.js
Created November 16, 2018 23:06
Semantic's Responsive with styled-jsx
import React from 'react'
import _ from 'lodash'
import PropTypes from 'prop-types'
import css from 'styled-jsx/css'
import { Responsive as SemanticResponsive } from 'semantic-ui-react'
import classNames from 'classnames'
import hoistNonReactStatics from 'hoist-non-react-statics'
class Responsive extends React.Component {
static propTypes = {
0x8A29d49BC5f95fB3448B134d825849FD9591cCEb