Skip to content

Instantly share code, notes, and snippets.

@Kartones
Kartones / postgres-cheatsheet.md
Last active May 7, 2024 17:48
PostgreSQL command line cheatsheet

PSQL

Magic words:

psql -U postgres

Some interesting flags (to see all, use -h or --help depending on your psql version):

  • -E: will describe the underlaying queries of the \ commands (cool for learning!)
  • -l: psql will list all databases and then exit (useful if the user you connect with doesn't has a default database, like at AWS RDS)
@DanHerbert
DanHerbert / fix-homebrew-npm.md
Last active February 12, 2024 17:18
Instructions on how to fix npm if you've installed Node through Homebrew on Mac OS X or Linuxbrew

OBSOLETE

This entire guide is based on an old version of Homebrew/Node and no longer applies. It was only ever intended to fix a specific error message which has since been fixed. I've kept it here for historical purposes, but it should no longer be used. Homebrew maintainers have fixed things and the options mentioned don't exist and won't work.

I still believe it is better to manually install npm separately since having a generic package manager maintain another package manager is a bad idea, but the instructions below don't explain how to do that.

Fixing npm On Mac OS X for Homebrew Users

Installing node through Homebrew can cause problems with npm for globally installed packages. To fix it quickly, use the solution below. An explanation is also included at the end of this document.

@jvns
jvns / interview-questions.md
Last active April 25, 2024 15:52
A list of questions you could ask while interviewing

A lot of these are outright stolen from Edward O'Campo-Gooding's list of questions. I really like his list.

I'm having some trouble paring this down to a manageable list of questions -- I realistically want to know all of these things before starting to work at a company, but it's a lot to ask all at once. My current game plan is to pick 6 before an interview and ask those.

I'd love comments and suggestions about any of these.

I've found questions like "do you have smart people? Can I learn a lot at your company?" to be basically totally useless -- everybody will say "yeah, definitely!" and it's hard to learn anything from them. So I'm trying to make all of these questions pretty concrete -- if a team doesn't have an issue tracker, they don't have an issue tracker.

I'm also mostly not asking about principles, but the way things are -- not "do you think code review is important?", but "Does all code get reviewed?".

@berzniz
berzniz / jshipster_and_and.js
Last active May 22, 2022 23:15
Some small javascript hacks for hipsters
// Boring
if (isThisAwesome) {
alert('yes'); // it's not
}
// Awesome
isThisAwesome && alert('yes');
// Also cool for guarding your code
var aCoolFunction = undefined;

Make it real

Ideas are cheap. Make a prototype, sketch a CLI session, draw a wireframe. Discuss around concrete examples, not hand-waving abstractions. Don't say you did something, provide a URL that proves it.

Ship it

Nothing is real until it's being used by a real user. This doesn't mean you make a prototype in the morning and blog about it in the evening. It means you find one person you believe your product will help and try to get them to use it.

Do it with style

@rwaldron
rwaldron / find.md
Last active December 14, 2015 11:28
ES6 Array.prototype.find spec

15.4.4.x Array.prototype.find ( predicate [ , thisArg ] )

predicate should be a function that accepts three arguments and returns a value that is coercible to the Boolean value true or false. find calls predicate once for each element present in the array, in ascending order, until predicate returns true and immediately returns the current array element. Otherwise, find returns null. predicate is called only for elements of the array which actually exist; it is not called for missing elements of the array.

  1. Let O be the result of ToObject passing the this value as the argument.
  2. ReturnIfAbrupt( O ).
  3. Let lenValue be the result of Get( O, "length" ).
  4. Let len be ToUint32( lenValue ).
  5. ReturnIfAbrupt( len ).
  6. If len is 0, return undefined.
@rwaldron
rwaldron / findindex.md
Last active December 14, 2015 11:29
ES6 Array.prototype.findIndex spec

15.4.4.x Array.prototype.findIndex ( predicate [ , thisArg ] )

predicate should be a function that accepts three arguments and returns a value that is coercible to the Boolean value true or false. findIndex calls predicate once for each element present in the array, in ascending order, until predicate returns true and immediately returns the index of the current array element. Otherwise, findIndex return -1. predicate is called only for elements of the array which actually exist; it is not called for missing elements of the array.

  1. Let O be the result of ToObject passing the this value as the argument.
  2. ReturnIfAbrupt( O ).
  3. Let lenValue be the result of Get( O, "length" ).
  4. Let len be ToUint32( lenValue ).
  5. ReturnIfAbrupt( len ).
  6. If len is 0, return -1.
@alano999
alano999 / README.md
Created September 15, 2012 15:12
Sequence (chain) multiple asynchronous jQuery operations, such as AJAX

MULTIPLE SEQUENTIAL ASYNCHRONOUS OPERATIONS IN JQUERY

Multiple asynchronous jQuery operations such as .ajax() and animations can be sequenced (chained) using the accompanying patterns which make use of jQuery Deferred techniques rather than the less extensible and non-ideal recursive call techniques.

There are three usage patterns, each implemented herein and tested using the supplied data for .ajax() transactions...

  1. Sequential in series using pre-defined data;
  2. Sequential in series, feeding each request using the response from previous request;
  3. Parallel request using pre-defined data, where responses are sequenced.
@MohamedAlaa
MohamedAlaa / tmux-cheatsheet.markdown
Last active May 8, 2024 07:49
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
@weakish
weakish / README.markdown
Last active December 18, 2023 05:58
#Solarized themes (dark and light) for #roxterm.