Skip to content

Instantly share code, notes, and snippets.

View cacheflow's full-sized avatar
🎯
Focusing

Lex Alexander cacheflow

🎯
Focusing
View GitHub Profile
@cacheflow
cacheflow / postgres_queries_and_commands.sql
Created September 26, 2020 02:44 — forked from zafergurel/postgres_queries_and_commands.sql
Useful PostgreSQL Queries and Commands
-- https://www.geekytidbits.com/performance-tuning-postgres/
-- http://www.craigkerstiens.com/2012/10/01/understanding-postgres-performance/
-- http://okigiveup.net/what-postgresql-tells-you-about-its-performance/
-- https://wiki.postgresql.org/wiki/Introduction_to_VACUUM,_ANALYZE,_EXPLAIN,_and_COUNT
-- https://devcenter.heroku.com/articles/postgresql-indexes#b-trees-and-sorting
-- http://www.databasesoup.com/2014/05/new-finding-unused-indexes-query.html
-- performance tools
-- https://www.vividcortex.com/resources/network-analyzer-for-postgresql
-- show running queries (pre 9.2)
@cacheflow
cacheflow / deploy_hooks.yml
Last active May 29, 2020 22:03 — forked from oliphunt/deploy_hooks.yml
Cloud66 custom deploy hook for configuring papertrail to log application logs. These go in your `.cloud66` deployment folder.
production:
after_rails:
- source: /.cloud66/log_files.yml
destination: /etc/log_files.yml
sudo: true
target: rails
apply_during: build_only
- source: /.cloud66/remote_syslog.init.d
destination: /etc/init.d/remote_syslog
@cacheflow
cacheflow / deploy_hooks.yml
Created May 29, 2020 21:50 — forked from armchairlinguist/deploy_hooks.yml
Cloud66 custom deploy hook for configuring papertrail to log application logs. These go in your `.cloud66` deployment folder.
production:
after_symlink:
- source: /.cloud66/log_files.yml
destination: /etc/log_files.yml
sudo: true
target: any
apply_during: all
- source: /.cloud66/remote_syslog.init.d
destination: /etc/init.d/remote_syslog

Technical Papers

2019

  1. Oct 15: Google's Bigtable paper
  2. Dec 5: "Producing Wrong Data Without Doing Anything Obviously Wrong!" +

2020

  1. Jan 20: "Source Code Rejuvenation is not Refactoring" +
@cacheflow
cacheflow / what-forces-layout.md
Created June 26, 2019 06:30 — forked from paulirish/what-forces-layout.md
What forces layout/reflow. The comprehensive list.

What forces layout / reflow

All of the below properties or methods, when requested/called in JavaScript, will trigger the browser to synchronously calculate the style and layout*. This is also called reflow or layout thrashing, and is common performance bottleneck.

Element

Box metrics
  • elem.offsetLeft, elem.offsetTop, elem.offsetWidth, elem.offsetHeight, elem.offsetParent
  • elem.clientLeft, elem.clientTop, elem.clientWidth, elem.clientHeight
  • elem.getClientRects(), elem.getBoundingClientRect()
@cacheflow
cacheflow / gist:4b81d16873261fd56dfc68cf21cabba7
Created June 12, 2019 17:08 — forked from ryanlecompte/gist:1283413
Providing an ActiveRecord-like before_filter capability to arbitrary Ruby classes
# First the end result of what we want:
class Foo
before_hook :whoa
before_hook :amazing
def test
puts "This is kinda cool!"
end
@cacheflow
cacheflow / .eslintrc
Created September 2, 2017 23:26 — forked from cletusw/.eslintrc
ESLint Reset - A starter .eslintrc file that resets all rules to off and includes a description of what each rule does. From here, enable the rules that you care about by changing the 0 to a 1 or 2. 1 means warning (will not affect exit code) and 2 means error (will affect exit code).
{
// http://eslint.org/docs/rules/
"ecmaFeatures": {
"binaryLiterals": false, // enable binary literals
"blockBindings": false, // enable let and const (aka block bindings)
"defaultParams": false, // enable default function parameters
"forOf": false, // enable for-of loops
"generators": false, // enable generators
"objectLiteralComputedProperties": false, // enable computed object literal property names
@cacheflow
cacheflow / dijkstra.rb
Last active August 29, 2015 14:21 — forked from yaraki/dijkstra.rb
#!/usr/bin/ruby1.9.1 -Kw
# -*- coding: utf-8 -*-
class Edge
attr_accessor :src, :dst, :length
def initialize(src, dst, length = 1)
@src = src
@dst = dst
@length = length
@cacheflow
cacheflow / introrx.md
Last active September 20, 2015 09:53 — forked from staltz/introrx.md

The introduction to Reactive Programming you've been missing

(by @andrestaltz)

So you're curious in learning this new thing called Reactive Programming, particularly its variant comprising of Rx, Bacon.js, RAC, and others.

Learning it is hard, even harder by the lack of good material. When I started, I tried looking for tutorials. I found only a handful of practical guides, but they just scratched the surface and never tackled the challenge of building the whole architecture around it. Library documentations often don't help when you're trying to understand some function. I mean, honestly, look at this:

Rx.Observable.prototype.flatMapLatest(selector, [thisArg])

Projects each element of an observable sequence into a new sequence of observable sequences by incorporating the element's index and then transforms an observable sequence of observable sequences into an observable sequence producing values only from the most recent observable sequence.

@cacheflow
cacheflow / index.md
Last active August 29, 2015 14:20 — forked from rstacruz/index.md

Rails Models

Generating models

$ rails g model User

Associations

belongs_to

has_one