Skip to content

Instantly share code, notes, and snippets.

@tlandn
tlandn / statuses.md
Created March 12, 2020 00:22 — forked from vkostyukov/statuses.md
HTTP status codes used by world-famous APIs
API Status Codes
[Twitter][tw] 200, 304, 400, 401, 403, 404, 406, 410, 420, 422, 429, 500, 502, 503, 504
[Stripe][stripe] 200, 400, 401, 402, 404, 429, 500, 502, 503, 504
[Github][gh] 200, 400, 422, 301, 302, 304, 307, 401, 403
[Pagerduty][pd] 200, 201, 204, 400, 401, 403, 404, 408, 500
[NewRelic Plugins][nr] 200, 400, 403, 404, 405, 413, 500, 502, 503, 503
[Etsy][etsy] 200, 201, 400, 403, 404, 500, 503
[Dropbox][db] 200, 400, 401, 403, 404, 405, 429, 503, 507
@tlandn
tlandn / enzyme-cheatsheet.js
Created December 21, 2019 03:43 — forked from jahe/enzyme-cheatsheet.js
Enzyme Cheatsheet
// Show rendered HTML
const wrapper = shallow(<App />)
console.log(wrapper.debug())
// Disable lifecycle methods of react within tests
const wrapper = mount(<App />, { disableLifecycleMethods: true })
// Assert number of occurrences
expect(wrapper.find('p').length).toBe(1)
@tlandn
tlandn / vanilla-js-cheatsheet.md
Created December 18, 2019 02:26 — forked from thegitfather/vanilla-js-cheatsheet.md
Vanilla JavaScript Quick Reference / Cheatsheet
@tlandn
tlandn / console.js
Created December 17, 2019 00:42 — forked from Harshmakadia/console.js
Mastering JS console like a Pro
// time and time end
console.time("This");
let total = 0;
for (let j = 0; j < 10000; j++) {
total += j
}
console.log("Result", total);
console.timeEnd("This");
// Memory
@tlandn
tlandn / css-media-queries-cheat-sheet.css
Created December 8, 2019 08:54 — forked from bartholomej/css-media-queries-cheat-sheet.css
CSS Media Query Cheat Sheet (with Foundation)
/*------------------------------------------
Responsive Grid Media Queries - 1280, 1024, 768, 480
1280-1024 - desktop (default grid)
1024-768 - tablet landscape
768-480 - tablet
480-less - phone landscape & smaller
--------------------------------------------*/
@media all and (min-width: 1024px) and (max-width: 1280px) { }
@media all and (min-width: 768px) and (max-width: 1024px) { }
@tlandn
tlandn / gist:8a2e67980eb5a5299a2f3c445bfddc99
Created November 6, 2019 09:00 — forked from nadesh-git/gist:908b9714f9c7f20b66dfb13b49ba346a
React native build issue - Androidx migration (June 2019)
Reference
https://developer.android.com/jetpack/androidx/migrate
android/build.gradle:
====================
buildscript {
ext {
googlePlayServicesVersion = "16.+"
firebaseVersion = "17.3.4"
@tlandn
tlandn / cta-blue.css
Created October 30, 2019 02:49
Create call to action buttons with CSS3.
/*
CTA Button - Blue
------------------------------------------------------------ */
a.cta-button-blue {
background-color: #77c4d5;
box-shadow: 0 4px 0 0 #66abbd;
}
a.cta-button-blue:hover {
"""
Django ORM Optimization Tips
Caveats:
* Only use optimizations that obfuscate the code if you need to.
* Not all of these tips are hard and fast rules.
* Use your judgement to determine what improvements are appropriate for your code.
"""
# ---------------------------------------------------------------------------
@tlandn
tlandn / node_nginx_ssl.md
Created September 23, 2019 12:27 — forked from bradtraversy/node_nginx_ssl.md
Node app deploy with nginx & SSL

Node.js Deployment

Steps to deploy a Node.js app to Digital Ocean using PM2, NGINX as a reverse proxy and an SSL from LetsEncrypt

1. Sign up for Digital Ocean

If you use the referal link below, you get $10 free (1 or 2 months) https://m.do.co/c/5424d440c63a

2. Create a droplet and log in via ssh

I will be using the root user, but would suggest creating a new user

Handlebars is a semantic web template system, started by Yehuda Katz in 2010.
Handlebars.js is a superset of Mustache, and can render Mustache templates in addition to Handlebars templates.
More: http://handlebarsjs.com/
1. Expressions.
1.1 Basic usage.