Skip to content

Instantly share code, notes, and snippets.

FWIW: I (@rondy) am not the creator of the content shared here, which is an excerpt from Edmond Lau's book. I simply copied and pasted it from another location and saved it as a personal note, before it gained popularity on news.ycombinator.com. Unfortunately, I cannot recall the exact origin of the original source, nor was I able to find the author's name, so I am can't provide the appropriate credits.


Effective Engineer - Notes

What's an Effective Engineer?

@rofr
rofr / transcript.txt
Created September 7, 2015 14:43
redis - the machine language of databases
INCR next_user_id //returns 1000
HMSET user:1000 name bart password ¤¤¤hash¤¤¤
HSET users bart 1000
ZADD followers:1000 1401267618 1234
ZADD following:1234 1401267618 1000
INCR next_post_id => 10343
HMSET post:10343 user 1000 time $time body ’Ay Caramba’
RPUSH posts:1000 10343
@bobbygrace
bobbygrace / trello-css-guide.md
Last active November 3, 2024 14:56
Trello CSS Guide

Hello, visitors! If you want an updated version of this styleguide in repo form with tons of real-life examples… check out Trellisheets! https://github.com/trello/trellisheets


Trello CSS Guide

“I perfectly understand our CSS. I never have any issues with cascading rules. I never have to use !important or inline styles. Even though somebody else wrote this bit of CSS, I know exactly how it works and how to extend it. Fixes are easy! I have a hard time breaking our CSS. I know exactly where to put new CSS. We use all of our CSS and it’s pretty small overall. When I delete a template, I know the exact corresponding CSS file and I can delete it all at once. Nothing gets left behind.”

You often hear updog saying stuff like this. Who’s updog? Not much, who is up with you?

###Edit this file

/etc/nginx/nginx.conf

###Add this line anywhere inside the http { } block:

ssl_protocols TLSv1 TLSv1.1 TLSv1.2;

###Go to your Forge panel and restart Nginx

@dlo
dlo / prefixes.sql
Last active November 25, 2021 03:26
PostgreSQL procedure that concatenates all prefix substrings for a given string. Helpful for generating full-text search indices.
CREATE FUNCTION prefixes(varchar, integer) RETURNS varchar AS $$
DECLARE
result varchar;
minlength integer;
BEGIN
SELECT GREATEST($2, 0) INTO length;
WITH RECURSIVE t(value, n) AS (
SELECT $1, length($1)
UNION ALL
SELECT substring(value for n-1), n-1 FROM t WHERE n>minlength
@consti
consti / hosts
Last active November 15, 2024 08:12
/etc/hosts to block shock sites etc.
# This hosts file is brought to you by Dan Pollock and can be found at
# http://someonewhocares.org/hosts/
# You are free to copy and distribute this file for non-commercial uses,
# as long the original URL and attribution is included.
#<localhost>
127.0.0.1 localhost
127.0.0.1 localhost.localdomain
255.255.255.255 broadcasthost
::1 localhost
$ = jQuery
TIMEOUT = 20000
lastTime = (new Date()).getTime()
setInterval ->
currentTime = (new Date()).getTime()
# If timeout was paused (ignoring small
# variations) then trigger the 'wake' event
if currentTime > (lastTime + TIMEOUT + 2000)
@nateberkopec
nateberkopec / secure_headers.rb
Created March 28, 2013 19:44
Example of a simple Rack middleware for scrubbing your Rack headers of sensitive information.
class Rack::SecureHeaders
def initialize(app, options = {})
@app, @options = app, options
end
def call(env)
response = @app.call(env)
# [status, headers, response] = response
@mattt
mattt / uiappearance-selector.md
Last active September 24, 2024 12:59
A list of methods and properties conforming to `UIAppearance` as of iOS 12 Beta 3

Generate the list yourself:

$ cd /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS*.sdk/System/Library/Frameworks/UIKit.framework/Headers
$ grep UI_APPEARANCE_SELECTOR ./*     | \
  sed 's/NS_AVAILABLE_IOS(.*)//g'     | \
  sed 's/NS_DEPRECATED_IOS(.*)//g'    | \
  sed 's/API_AVAILABLE(.*)//g'        | \
  sed 's/API_UNAVAILABLE(.*)//g'      | \
 sed 's/UI_APPEARANCE_SELECTOR//g' | \
(function($){
var insertAtCaret = function(value) {
if (document.selection) { // IE
this.focus();
sel = document.selection.createRange();
sel.text = value;
this.focus();
}
else if (this.selectionStart || this.selectionStart == '0') {
var startPos = this.selectionStart;