Skip to content

Instantly share code, notes, and snippets.

View hosmelq's full-sized avatar
🎯
Focusing

Hosmel Quintana hosmelq

🎯
Focusing
View GitHub Profile
package your.package;
/*
* Copyright (C) 2014 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
{
"pomegranate": {
"50": "#f9ebea",
"100": "#f2d7d5",
"200": "#e6b0aa",
"300": "#d98880",
"400": "#cd6155",
"500": "#c0392b",
"600": "#a93226",
"700": "#922b21",
@hosmelq
hosmelq / raven-config.html
Created July 17, 2016 04:14 — forked from impressiver/raven-config.html
Raven.js configuration for logging JavaScript exceptions to Sentry (https://getsentry.com/). Without the added ignore options, you'll quickly find yourself swamped with unactionable exceptions due to shoddy browser plugins and 3rd party script errors.
<!-- Raven.js Config -->
<script src="{{ JS_PATH }}/lib/raven.js" type="text/javascript"></script>
<script type="text/javascript">
// Ignore list based off: https://gist.github.com/1878283
var ravenOptions = {
// Will cause a deprecation warning, but the demise of `ignoreErrors` is still under discussion.
// See: https://github.com/getsentry/raven-js/issues/73
ignoreErrors: [
// Random plugins/extensions
'top.GLOBALS',
@hosmelq
hosmelq / nginx.conf
Created February 14, 2017 20:53 — forked from plentz/nginx.conf
Best nginx configuration for improved security(and performance). Complete blog post here http://tautt.com/best-nginx-configuration-for-security/
# to generate your dhparam.pem file, run in the terminal
openssl dhparam -out /etc/nginx/ssl/dhparam.pem 2048
@hosmelq
hosmelq / _Stay_standalone.md
Created June 29, 2017 16:44 — forked from irae/_Stay_standalone.md
Stay Standalone: Prevent links in standalone web apps opening Mobile Safari

#Stay Standalone

A short script to prevent internal links to a "webapp" added to iPhone home screen to open in Safari instead of navigating internally.

@hosmelq
hosmelq / lambda-at-edge.yaml
Created October 22, 2018 04:07 — forked from stu-smith/lambda-at-edge.yaml
Shows how to use CloudFormation to attach a Lambda@Edge function to a CloudFront distribution to add HSTS and CSP custom headers. NOTE: The stack must be updated twice: once with the condition set to false, and once with it set to true.
AWSTemplateFormatVersion: 2010-09-09
Parameters:
RootDomainName:
Type: String
IncludeLambdaEdge:
Type: String
AllowedValues: ['true', 'false']
Conditions:
IncludeLambdaEdge:
!Equals ['true', !Ref IncludeLambdaEdge]
@hosmelq
hosmelq / nginx-tuning.md
Created November 12, 2018 22:17 — forked from denji/nginx-tuning.md
NGINX tuning for best performance

Moved to git repository: https://github.com/denji/nginx-tuning

NGINX Tuning For Best Performance

For this configuration you can use web server you like, i decided, because i work mostly with it to use nginx.

Generally, properly configured nginx can handle up to 400K to 500K requests per second (clustered), most what i saw is 50K to 80K (non-clustered) requests per second and 30% CPU load, course, this was 2 x Intel Xeon with HyperThreading enabled, but it can work without problem on slower machines.

You must understand that this config is used in testing environment and not in production so you will need to find a way to implement most of those features best possible for your servers.

@hosmelq
hosmelq / machine.js
Last active October 9, 2019 23:21
Generated by XState Viz: https://xstate.js.org/viz
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
@hosmelq
hosmelq / machine.js
Last active November 1, 2019 15:56
Generated by XState Viz: https://xstate.js.org/viz
new Machine(
{
id: `signIn`,
initial: `ready`,
context: {
email: ``,
password: ``
},
states: {
ready: {
@hosmelq
hosmelq / machine.js
Last active November 11, 2019 18:11
Generated by XState Viz: https://xstate.js.org/viz
function produce() {
return {}
}
const machine = new Machine(
{
id: `text-input-machine`,
type: `parallel`,
context: {
errorMessage: null,