Skip to content

Instantly share code, notes, and snippets.

@cooljl31
cooljl31 / ansible-localhost.md
Last active May 25, 2022 08:55 — forked from ryantuck/ansible-localhost.md
super fast way to start testing ansible stuff locally without VMs

set up ansible to work on localhost

i've found this useful for debugging ansible modules and syntax without having to use VMs or test in dev environments.

install ansible

pip install ansible

make some relevant config files

@cooljl31
cooljl31 / l10n_IETF_Language_tags.md
Created May 6, 2022 10:52 — forked from traysr/l10n_IETF_Language_tags.md
Commonly used IETF language tags
@cooljl31
cooljl31 / rules.htaccess
Last active April 26, 2022 09:06
Rewrite Rules in .htaccess files
RewriteEngine On
Options +FollowSymLinks
RedirectMatch 301 ^([^_]*)_([^_]*)_([^_]*)_([^_]*)_([^_]*)_([^_]*)_([^_]*)_([^_]*)_(.*)$ https://www.shipcloud.io/$1-$2-$3-$4-$5-$6-$7-$8-$9/ [E=underscore_replacer:Yes]
RedirectMatch 301 ^([^_]*)_([^_]*)_([^_]*)_([^_]*)_([^_]*)_([^_]*)_([^_]*)_(.*)$ https://www.shipcloud.io/$1-$2-$3-$4-$5-$6-$7-$8/ [E=underscore_replacer:Yes]
RedirectMatch 301 ^([^_]*)_([^_]*)_([^_]*)_([^_]*)_([^_]*)_([^_]*)_(.*)$ https://www.shipcloud.io/$1-$2-$3-$4-$5-$6-$7/ [E=underscore_replacer:Yes]
RedirectMatch 301 ^([^_]*)_([^_]*)_([^_]*)_([^_]*)_([^_]*)_(.*)$ https://www.shipcloud.io/$1-$2-$3-$4-$5-$6/ [E=underscore_replacer:Yes]
RedirectMatch 301 ^([^_]*)_([^_]*)_([^_]*)_([^_]*)_(.*)$ https://www.shipcloud.io/$1-$2-$3-$4-$5/ [E=underscore_replacer:Yes]
RedirectMatch 301 ^([^_]*)_([^_]*)_([^_]*)_(.*)$ https://www.shipcloud.io/$1-$2-$3-$4/ [E=underscore_replacer:Yes]
RedirectMatch 301 ^([^_]*)_([^_]*)_(.*)$ https://www.shipcloud.io/$1-$2-$3/ [E=underscore_replacer:Yes]
@cooljl31
cooljl31 / nginx-config-rails4-with-puma-ssl-version.conf
Created April 8, 2022 07:16 — forked from rkjha/nginx-config-rails4-with-puma-ssl-version.conf
Nginx config for rails 4 application using puma [ssl and non-ssl version]
upstream myapp_puma {
server unix:/tmp/myapp_puma.sock fail_timeout=0;
}
# for redirecting to https version of the site
server {
listen 80;
rewrite ^(.*) https://$host$1 permanent;
}
@cooljl31
cooljl31 / each_benchmark.rb
Created March 14, 2022 10:27
each_benchmark.rb
#!/usr/bin/env ruby -w
require "benchmark"
TIMES = 100_000
ARRAY = (1..1_000).to_a
Benchmark.bm(30) do |b|
b.report "each" do
TIMES.times do |i|
ARRAY.each do |element|
@cooljl31
cooljl31 / mac-setup-redis.md
Created September 1, 2021 11:59 — forked from tomysmile/mac-setup-redis.md
Brew install Redis on Mac

type below:

brew update
brew install redis

To have launchd start redis now and restart at login:

brew services start redis
@cooljl31
cooljl31 / deep-merge.js
Created August 20, 2021 12:08 — forked from ahtcx/deep-merge.js
Deep-Merge JavaScript objects with ES6
// Merge a `source` object to a `target` recursively
const merge = (target, source) => {
// Iterate through `source` properties and if an `Object` set property to merge of `target` and `source` properties
for (const key of Object.keys(source)) {
if (source[key] instanceof Object) Object.assign(source[key], merge(target[key], source[key]))
}
// Join `target` and modified `source`
Object.assign(target || {}, source)
return target
@cooljl31
cooljl31 / README.md
Last active June 20, 2021 13:28
A minimal Storybook(v6) configuration for Gatsby

Install Gatsby global

npm i -g @storybook/cli

# This command adds a set of boilerplate files for Storybook in your project. You also need to update storybook configuration for Gatsby project.
sb init

Update package.json

@cooljl31
cooljl31 / jest-cheatsheet.md
Created September 28, 2020 12:01 — forked from tpai/jest-cheatsheet.md
paste jest cheatsheet
@cooljl31
cooljl31 / hello-apple.md
Created July 30, 2020 17:14 — forked from Linrstudio/hello-apple.md
solutions for window.innerWidth / innerHeight issue in iOS9

iOS9 returns double the value for window.innerWidth & window.innerHeight
The versions that are concerned are: 9.0.0, 9.0.1, 9.0.2

A few people got mad on twitter:

window.innerWidth in iOS 9 Safari returns double the number it did in iOS 8? Is this real life? tell me no — @rachsmithtweets
iOS9 Safari has the most insane bug where window.innerWidth / innerHeight is *sometimes* twice as large as it should be. ughhhh. !? — @mattdesl

iOS9 innerWidth/innerHeight is having a lot of fun these days — @ayamflow