Skip to content

Instantly share code, notes, and snippets.

Avatar

Linell Bonnette Linell

View GitHub Profile
View init.vim
" Plugin Setup
call plug#begin('~/.config/nvim/plugged')
Plug 'airblade/vim-gitgutter'
Plug 'cloudhead/neovim-fuzzy'
Plug 'ctrlpvim/ctrlp.vim'
Plug 'dracula/vim', { 'as': 'dracula' }
Plug 'junegunn/vim-easy-align'
Plug 'mattn/gist-vim'
Plug 'mattn/webapi-vim'
Plug 'mihaifm/bufstop'
View .tmux.conf
set-option -g status-keys vi
set-window-option -g mode-keys vi
set -g mouse on
set-option -g history-limit 10000
set -s escape-time 0
set -g aggressive-resize on
unbind ^X
@Linell
Linell / question.rb
Created Sep 4, 2019
Is there a better version of this code?
View question.rb
# Original code. The problem here is that if there's an existing
# Bar object for the user then we end up with two objects. That's
# a valid case though -- we just don't want it here. I want it to
# result in the user having one confirmed Bar object.
foo = Bar.create_or_raise(
user: user,
entity: entity,
status: :confirmed,
role: :owner
)
View temperaturePutTest.json
{
"body": "{\"temperature\":\"72.00\",\"pressure\":\"1234.45\",\"rh\":\"12.34\"}",
"resource": "/{proxy+}",
"requestContext": {
"resourceId": "123456",
"apiId": "1234567890",
"resourcePath": "/{proxy+}",
"httpMethod": "POST",
"requestId": "c6af9ac6-7b61-11e6-9a41-93e8deadbeef",
"accountId": "123456789012",
View .vimrc
filetype plugin on
filetype plugin indent on
syntax on
filetype indent on
set autoindent
set autoread
set backspace=2
set clipboard=unnamed
set cursorline
@Linell
Linell / Procfile
Created Feb 7, 2018
Sidekiq Web UI
View Procfile
web: bundle exec puma -t 4:16 config.ru -p $PORT
worker: bundle exec sidekiq -r ./app.rb
View ImageMagick 6.9.7-3 Homebrew Formula.md

Homebrew Formula patching old ImageMagick release 6.9.7-3

Install

$ brew install https://gist.githubusercontent.com/afaur/15fbb18b28e2140ec3fda8b098262e55/raw/b733366d08da64f87bc889eebf173f4e50e394bc/imagemagick.rb

Tested

View parser.ex
defmodule Mix.Tasks.Parser do
use Mix.Task
require IEx
@shortdoc "A test of the parser."
def run(_args) do
Mix.shell.info "Greetings from the parser"
# The following tree represents a query that looks like:
View thing.sql
-- Works perfectly!
SELECT COUNT(*),
ST_Union(geom) as location_union,
ST_SnapToGrid(ST_Transform(ST_SnapToGrid(ST_Transform(geom, _ST_BestSRID(geom)), 10,10),4326),0.0001, 0.0001) AS snap_pt
FROM locations
GROUP BY snap_pt
HAVING COUNT(*) > 1;
-- But what's a decent way to figure out which groups contain a given user?
-- I can use the following query to get the list of users in an example ST_Union from above:
@Linell
Linell / euler_one.ex
Created Sep 2, 2015
Project Euler problem on in Elixir.
View euler_one.ex
Enum.filter(1..999, fn(x) -> rem(x, 5) == 0 || rem(x, 3) == 0 end)
|> Enum.reduce(fn(x, acc) -> acc + x end)
# 233168
You can’t perform that action at this time.