Skip to content

Instantly share code, notes, and snippets.

View blaix's full-sized avatar

Justin Blake blaix

View GitHub Profile
@blaix
blaix / whatversionoftmuxamirunning.txt
Created August 18, 2017 17:44
I just wanted to know what version of tmux I'm running...
$ tmux --version
tmux: illegal option -- -
usage: tmux [-2CluvV] [-c shell-command] [-f file] [-L socket-name]
[-S socket-path] [command [flags]]
$ tmux --help
tmux: illegal option -- -
usage: tmux [-2CluvV] [-c shell-command] [-f file] [-L socket-name]
[-S socket-path] [command [flags]]
@blaix
blaix / about.md
Created August 9, 2011 15:08 — forked from jasonrudolph/about.md
Programming Achievements: How to Level Up as a Developer

Programming Achievements: How to Level Up as a Developer

  1. Select a particular experience to pursue.
  2. Pursue that experience to completion. (Achievement unlocked!)
  3. Reflect on that experience. Really soak it in. Maybe a blog post would be in order?
  4. Return to Step 1, this time selecting a new experience.

This gist is a fork of the gist from this blog post.

@blaix
blaix / elm-language-server.md
Last active October 21, 2023 10:42
Troubleshooting issues with elm language server
  • Sometimes it just gets flat-out confused and needs to be restarted.
    • :lsp-restart in helix
    • Ctrl + Shift + P and search restart language language server in vscode
  • Are you using lamdera? or elm-pages (which uses the lamdera compiler)?
    • Tell your editor to use lamdera as the elm path/command.
    • Try lamdera reset
    • ...you may need to trigger a build afterwards (e.g. by loading site after lamdera live)
    • Try copying ~/.lamdera to ~/.elm (supposedly this will be fixed in a future version)
  • Sometimes setting up elm-tooling in the project will work when the global elm tools won't. Don't know why.
  • Check logs. Search google and elm channels (below) for errors.
# Install ruby 1.8.6 using the one-click windows installer from:
# http://www.ruby-lang.org/en/downloads/
# Be sure to check the box to enable rubygems during the install.
# Make sure C:\bin exists and is in your path.
# Now open a command-prompt and run:
> gem install pik
> pik_install C:\bin
> pik install ruby 1.8.7
> pik use 187
@blaix
blaix / test.py
Created November 26, 2012 22:12
Patching an entire test class in python
from unittest import TestCase
from mock import patch
from my.module import MyClass
@patch("my.module.OtherClass")
class TestMyClass(TestCase):
def test_something(self, mocked_other_class):
@blaix
blaix / service-objects.md
Created June 12, 2013 11:04
Martin Fowler on Service Objects via the Ruby Rogues Parley mailing list

On Tue, Mar 12, 2013 at 1:26 PM, Martin Fowler martinfowlercom@gmail.com wrote:

The term pops up in some different places, so it's hard to know what it means without some context. In PoEAA I use the pattern Service Layer to represent a domain-oriented layer of behaviors that provide an API for the domain layer. This may or may not sit on top of a Domain Model. In DDD Eric Evans uses the term Service Object to refer to objects that represent processes (as opposed to Entities and Values). DDD Service Objects are often useful to factor out behavior that would otherwise bloat Entities, it's also a useful step to patterns like Strategy and Command.

It sounds like the DDD sense is the sense I'm encountering most often. I really need to read that book.

The conceptual problem I run into in a lot of codebases is that rather than representing a process, the "service objects" represent "a thing that does the process". Which sounds like a nitpicky difference, but it seems to have a real impact on how people us

I like to mirror the process of "going to work" even when I'm working from home. Get dressed. Brush teeth. Etc. and physically move to a dedicated work space. Same for "coming home". And keeping consistent working hours. Basically anything you can do to put a line between "at work" and "at home" in your mind, and and it helps with your kids/family if you have them.

You have to fight the urge to "power through" when you start to get stuck. Since no one is looking over your shoulder it's easy to waste time spinning your wheels. Work on your "ask questions" reflex.

On that note, prefer asking in public channels over DMs. Better chance that you'll get an answer, and it can help others. And it also provides positive pressure to make sure you'll asking the question well, and combats the feeling that you might be bothering someone in particular.

The pomodoro technique is great. Focus on one thing for 25 mins (or any length that works for you) , then take a 5 min break. Physically get out of your chair and look at

@blaix
blaix / selfie.rb
Last active November 21, 2022 09:18
How to understand `extend self` and `class << self` in ruby.
# Everything in ruby is an object which is an instance of a class. Even classes
# themselves are objects that are instances of the class `Class`.
class Dog
end
puts Dog.class # => Class
# When you use the class keyword, you are opening a class to define instance
# methods for any instance of the class:
# single-purpose objects for handling requests:
class CreateArticle
attr_reader :repo, :validations
def initialize(repo:, validator:)
@repo = repo
@validator = validator
end
def call(params)
@blaix
blaix / nginx
Created September 3, 2010 14:44
nginx init script for nginx compiled from source on ubuntu with /usr/local/nginx prefix.
#! /bin/sh
### BEGIN INIT INFO
# Provides: nginx
# Required-Start: $all
# Required-Stop: $all
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: starts the nginx web server
# Description: starts nginx using start-stop-daemon