Skip to content

Instantly share code, notes, and snippets.

@kalaschnik
kalaschnik / RStudio-in-WSL2.md
Last active March 14, 2024 20:41
Run RStudio in the Windows Subsystem for Linux 2 (WSL 2) using Pengwin and X410
@joshbuchea
joshbuchea / semantic-commit-messages.md
Last active June 1, 2024 19:36
Semantic Commit Messages

Semantic Commit Messages

See how a minor change to your commit message style can make you a better programmer.

Format: <type>(<scope>): <subject>

<scope> is optional

Example

@joshschmelzle
joshschmelzle / remap-capslock-to-control-win10.md
Last active May 13, 2024 01:55
Remap Caps Lock to Control on Windows 10

Ways to remap caps lock to control on Windows 10

These methods in this gist worked for me on my U.S.-based keyboard layouts. I am unsure about other layouts. If you have problems, revert your changes; delete the registry key you created (and reboot).

Update: you should probably scroll down to approach 4 where I suggest using Microsoft PowerToys Keyboard Manager.

Approach 1. Manually through regedit

Navigate to and create a new binary value in HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Keyboard Layout named Scancode Map.

@omnibs
omnibs / phoenix showdown rackspace onmetal io.md
Last active January 25, 2023 18:33
Phoenix Showdown Comparative Benchmarks @ Rackspace

Comparative Benchmark Numbers @ Rackspace

I've taken the benchmarks from Matthew Rothenberg's phoenix-showdown, updated Phoenix to 0.13.1 and ran the tests on the most powerful machines available at Rackspace.

Results

Framework Throughput (req/s) Latency (ms) Consistency (σ ms)
@Kartones
Kartones / postgres-cheatsheet.md
Last active May 27, 2024 08:12
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)
@Arkham
Arkham / vimrc
Created March 24, 2014 16:50
Convert old rspec should syntax to new expect syntax
function! ConvertShouldToExpect()
let rspec_conversions = {
\ 'should': 'to',
\ 'should_not': 'not_to',
\ 'should_receive': 'to receive',
\ 'should_not_receive': 'not_to receive',
\ }
for [old, new] in items(rspec_conversions)
execute "normal! " . ':%s/\v^(\s+)(.+)\.' . old . '>/\1expect(\2).' . new . '/ge' . "\<CR>"
@xnzac
xnzac / github-fetch-forks
Last active December 25, 2015 16:09
Fetch all forks of github repository. Uses gems 'github_api' and 'hub'
#!/usr/bin/env ruby
# Install gems:
# gem install github_api
# gem install hub
#
# Then run script in github repo
require 'github_api'
g = Github.new
@henrik
henrik / rules.md
Last active May 23, 2022 12:31
Sandi Metz' four rules from Ruby Rogues episode 87. Listen or read the transcript: http://rubyrogues.com/087-rr-book-clubpractical-object-oriented-design-in-ruby-with-sandi-metz/
  1. Your class can be no longer than 100 lines of code.
  2. Your methods can be no longer than five lines of code.
  3. You can pass no more than four parameters and you can’t just make it one big hash.
  4. When a call comes into your Rails controller, you can only instantiate one object to do whatever it is that needs to be done. And your view can only know about one instance variable.

You can break these rules if you can talk your pair into agreeing with you.

@pbiggar
pbiggar / gist:3166676
Created July 23, 2012 22:35
Sample circle.yml file
########################
# Customize the test machine
########################
machine:
# Set the timezeone - any value from /usr/share/zoneinfo/ is valid here
timezone:
America/Los_Angeles
# Version of ruby to use
@dhh
dhh / gist:2643144
Created May 9, 2012 08:57
Coding stats from the new Basecamp
bcx david$ rake stats
+----------------------+-------+-------+---------+---------+-----+-------+
| Name | Lines | LOC | Classes | Methods | M/C | LOC/M |
+----------------------+-------+-------+---------+---------+-----+-------+
| Controllers | 3704 | 2942 | 72 | 479 | 6 | 4 |
| Helpers | 1901 | 1529 | 13 | 261 | 20 | 3 |
| Models | 5310 | 4116 | 50 | 653 | 13 | 4 |
| Libraries | 2167 | 1593 | 51 | 200 | 3 | 5 |
| Integration tests | 297 | 217 | 6 | 1 | 0 | 215 |
| Functional tests | 3897 | 3065 | 61 | 11 | 0 | 276 |