Skip to content

Instantly share code, notes, and snippets.

💭
lol

Steve Lacy stevelacy

💭
lol
Block or report user

Report or block stevelacy

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@stevelacy
stevelacy / func-to-arrow-func.js
Created Apr 24, 2019
method to arrow function code mod
View func-to-arrow-func.js
module.exports = function transform(file, api) {
const j = api.jscodeshift
function withComments(to, from) {
to.comments = from.comments
return to
}
function createArrowProperty(prop) {
return withComments(j.classProperty(
@stevelacy
stevelacy / file.go
Last active Mar 14, 2019
Open a 99M (1,000,000 line) text file in golang and store as []Rows
View file.go
package main
import (
"bufio"
"fmt"
"os"
"strconv"
"strings"
"time"
)
@stevelacy
stevelacy / docker-compose-migration.yaml
Created Oct 11, 2018
Docker compose file with migrations and nginx + nginx-proxy
View docker-compose-migration.yaml
version: "3"
services:
api:
image: "stevelacy/imagehere"
command: ["/app/init"]
ports:
- 80
depends_on:
- migration
@stevelacy
stevelacy / delete-slow-pg-queries.md
Created Apr 17, 2018
Delete slow or long running queries on postgres
View delete-slow-pg-queries.md
SELECT pg_cancel_backend(pid),
  pid,
  now() - pg_stat_activity.query_start AS duration,
  query,
  state
FROM pg_stat_activity WHERE (now() - pg_stat_activity.query_start) > interval '5 minutes';
@stevelacy
stevelacy / tile38-intersect.sh
Created Mar 23, 2018
Check if time of results are cached
View tile38-intersect.sh
#!/bin/bash
random1=$(((RANDOM % 10) + 1))
random2=$(((RANDOM % 10) + 1))
tile38-cli 'INTERSECTS boundaries IDS OBJECT { "type": "Polygon", "coordinates": [ [ [ -74.0460'${random1}'53381, 40.750743837'${random1}'4 ], [ -74.05118'${random2}'1453, 40.743'${random1}'9884844 ], [ -74.0452'${random2}'9195, 40.7409'${random1}'41359 ], [ -74.04'${random1}'1958618, 40.7486712'${random1}'115 ], [ -74.0460'${random1}'53381, 40.750743837'${random1}'4 ] ] ] }'
@stevelacy
stevelacy / glitch.md
Last active Mar 12, 2018
͓͉̬͙͆ͨͣͥ̇͊ͫͣ̿̿̑̚̚̕@̶̡̣͖͙̺͈̤̹̹̦͆͐ͯͤ̿̂͑̈́͂̆̏̔̌̚̕̕͟$̵̶ͩ̾̌̅̎͋̊͗ͪ́
View glitch.md

K̷̢̦͔̣̲͕̟̜̬̘͎̟̍̔ͧͦͩ͊ͩͪ̈̃̕͡ͅͅ@̴̨͔̠͍̣̮̙̲̝̥̋ͫ͑̔̉͆̆̃̄͂̑̕n̵̳̗͖̥̹͉̜͕̻͓̠̜͋̈̅̄͐͐ͮ̑̿̀ ̨̛̱͈̣͚̫̳̦̭̭͇̲͓͔̙͆͗̂̅ͫ̓̇̄ͤ͆̄͛ͮ͐͘͜͞ͅͅv̶̸̢̳̳̪͔͈̬̆̈ͮ̌̀̓̓̈́ͥ̏ͫ͒͗̚ͅ1̴̶͇̯̼̲̩̘͔͖͔͗̑̓̃͑̐́͆̊̉͆́ͧ̃͢3̶̨̡̲̘̖̝̥̣͖̤̰̖̗̭̎̓̒̆͋ͯ̋̆͠ͅw̶̨̥̤͕̤̩̦ͧͨ͛̽̄́͆ͥͤ͠ ̵̴̲͍̙̪̞̠͎̩ͦ͌͊͐́͌̉̎̄̓͝ŗ̸̡͚̘͚͈ͩ͆̆ͦ͒̍3̹̠͕͈͙͎̘̠ͮ̾̿͛ͤ͗͒ͫ́͞ͅ5̶̥͔̞̭̤̜̥̺̻̲̭̭͉̘̬̂ͥ̿ͦͥ͛̽͋͢u̸̧̳͈͈̪̣̠͈̍́̔͑̒ͥ͊̽͆͊̓̈̊̑ͧ̓̊̋̀͟͢|̨̥͈̙͇͌ͨ̇̉̀̒̆̊ͯͬͫ̄̌ͣ̽̂̐ͪ̕͞7̨̘̖̮̥̪̈́̾̒͑̄͋ͨ̂͒̀ͣ͆̊̓̚͘͝z̸̨̝̯͚̻̈͗ͯ͒͗ͮ̓̊̇̍ ̧̧͖͉̯̖̬̫͈̦͕̖̱̰̩͚̦̦̖̔̆ͯ̾ͯ̚͜͡d̢͙̗̳̤͎͔̹̱͍͔̺͎̒̿̎̉̍ͦͤͧͨ͠ͅ0̵̷͖̯͓͎̝̪̹̫̮͈̮̼̩̇ͪͣ͛̇̓͛͗ͣ͐̍̒́͂͗̏͂̕͘͜,̸̴͎̬̮̆̏ͮ̐ͮ̈ͤͫ̓̽͑ͪ̅͋͌́̕ ̸̜͓͙͇̥͉̗͉͒̂̊̓ͩ̈́ͦ̓͋ͭ͊̂̓̆́͢͞͝͠ͅW̢̨ͭ̒̔̋͏̯̤͎̣̜͇̯ͅh̷̰͍̰͉̘̯̳̥̥̼͔͔̤͈̰̩͆̓̃̈́̃̕1͎̭̗͉̗͕̥̯̰̭̼̘̃ͯ̇ͣ́͜͡Ç̛̥̻̲̺̝̹̮̗̙̼̱̬͒͆̆̚͟͞h̿ͬ̋̍̄̇̈́ͬ͑͋̐ͬ̌̅͏̱̝̗̫̫̭̥̩̤̮̝̭͙̯̞̥͜ ̸̡̬̪̗̗̣͖̯͖̣̹̹̣̰̋ͯ̏ͯͯͣ̇ͤ͐̚ͅ|̡̠̩̣̠̤̦̼͖̬̗̫̻̹̫͓ͤ̂ͬ͆͋ͯ̍̃̀͝2ͣͦ̂ͫ̿͛̓͊̍ͭ̽̆̽̿͝͡҉̸̵̤̻͇̹͉͚͓͚̙̱͚̰̬̲1̶̷̷̖͍͖͓̩̠̦͚͕͐̎̎̌̓ͪ̆̅̔̀̆͌͊ͥͩ̈̈̿ͯg̱̰̰̫͓̩̘͙̝͊̒̍ͮ̿ͨ̃ͧ͆̾̃̈͋ͩ̄̀̚͡h̡̘̺͖̤͍̰̟̠̮͖̼̐̿̃ͮ̂ͮ̽̎̿ͪ̓́͜͟7̝͙̦̤̘̬͎̖̥̳̤̱̤̹̰͕̫̪͓ͯͩͪ̒̈̍̑͂ͥ̂ͥ͘͠ ͆͗̏̍̈́̃ͫ̔ͥ̃ͦͣ̚҉̷̝̩̱͔̟̜̤̟̺̳̩̹̝̖̯̮͎͖͜(̶̸̬̼͓̗͉̥̻͔͔̝̮͕̗͖͔̣͊̎̏ͣͅ4̴̿͒̈́͊̏̅͆ͨ͏̷̝̞̺̫̯͈̖͙̖̥(̵̺͈̲̯͔̬̤̰ͥ̆̓ͮ͆͋͋̌̽͘͟͜͡]̶̛̝̥̤̮̳͔̹͉͖͚͎̬̺̘̔̏̍͌-̶̢̟͔̣̞͓̤ͮͪͫ̊͛̏̓ͨ̈́͊̋̉̂̈ͦ͊̚̕͢[̛̼̘̺̗̤̦ͩ̐̅ͣ̓̈́ͮ͑̊͡

@stevelacy
stevelacy / check-database-toast-tables.md
Created Feb 27, 2018
look for corrupt postgres toast tables (with uuid)
View check-database-toast-tables.md
View query-friend-relations.sql
-- Given the following schema:
CREATE TABLE public.friendships
(
"createdAt" timestamp with time zone NOT NULL,
"updatedAt" timestamp with time zone NOT NULL,
"userId" uuid NOT NULL,
"friendId" uuid NOT NULL,
CONSTRAINT friendships_pkey PRIMARY KEY ("userId", "friendId"),
View hex.sass
.categories .hex
width: 208px
height: 120px
background: $color-white
position: relative
&.wrapper
margin-top: 65px
margin-right: 15px
display: inline-block
You can’t perform that action at this time.