Skip to content

Instantly share code, notes, and snippets.

View rafpiek's full-sized avatar

Rafał Piekara rafpiek

  • Kraków, Poland
View GitHub Profile
@rafpiek
rafpiek / puma.rb
Last active June 7, 2021 09:30
Puma config
# Min and Max threads per worker
threads 1, 50
workers 3
app_dir = File.expand_path("../..", __FILE__)
app_name = 'app_name'
app_dir = "/var/www/#{app_name}"
shared_dir = "/var/www/#{app_name}/shared"
# Default to production
@rafpiek
rafpiek / nginx
Last active January 9, 2020 09:55
upstream app {
# Path to Puma SOCK file, as defined previously
server unix:/home/deploy/appname/shared/sockets/puma.sock fail_timeout=0;
}
server {
listen 80;
server_name localhost;
root /home/deploy/appname/public;
@rafpiek
rafpiek / livetemplate.js
Created June 28, 2019 09:31
Functional Component
import React, { useState, useEffect } from 'react'
import PropTypes from 'prop-types'
import styled from 'styled-components'
const StyledWrapper = styled.div`
`
const $TM_FILENAME_BASE$ = ({ $props$ }) => {
def respond(body: nil, status: 200, serializer: nil, each_serializer: nil)
if serializer.present?
render json: body, status: status, serializer: serializer
elsif each_serializer.present?
render json: body, status: status, each_serializer: each_serializer
else
render json: HashConverter.to_camel_case(body.as_json), status: status
render json: HashConverter.to_camel_case(body.as_json.merge!(meta)), status: status
end
end
echo "\n================================\n"
echo "Starting build \n"
yarn build
echo "Build finished \n"
echo "\n================================\n"
echo "\n================================\n"
echo "Startin upload \n"
aws s3 cp ./build/ s3://todoardo --recursive --acl public-read
echo "Upload finished \n"
echo "\n================================\n"
import i18next from "i18next";
import locales from "./locales";
class Locales {
static init() {
i18next.init(
{
lng: "en",
debug: false,
resources: locales,
import { constants } from "utils";
export const emailValidator = (text) => ({
isValid: constants.regex.email.test(text),
});
export const passwordValidator = (text) => ({
isValid: constants.regex.password.test(text),
});
@rafpiek
rafpiek / init_css.scss
Created August 4, 2020 12:50
Initial general css
*, *::before, &::after {
margin: 0;
padding: 0;
font-family: $font-body;
color: $color-text-primary;
box-sizing: border-box;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
@rafpiek
rafpiek / fetchMock.js
Last active October 11, 2020 18:44
fetchMock.js
const fetchMock = (url, suffix = "") => (
new Promise((resolve) => (
setTimeout(() => {
resolve({
json: () => (
Promise.resolve({
data: url + suffix,
}),
)
})
@rafpiek
rafpiek / callAll.js
Last active December 8, 2020 14:54
callAll
function callAll(...fns) {
return (...args) => {
fns.forEach(fn => {
fn && fn(...args)
})
}
}