Skip to content

Instantly share code, notes, and snippets.

View Linell's full-sized avatar
🧙

Linell Bonnette Linell

🧙
View GitHub Profile
" 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'
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 September 4, 2019 14:49
Is there a better version of this code?
# 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
)
{
"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",
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 February 7, 2018 15:35
Sidekiq Web UI
web: bundle exec puma -t 4:16 config.ru -p $PORT
worker: bundle exec sidekiq -r ./app.rb
@Linell
Linell / ImageMagick 6.9.7-3 Homebrew Formula.md
Last active January 9, 2018 16:52 — forked from afaur/ImageMagick 6.9.7-3 Homebrew Formula.md
Homebrew Formula for ImageMagick 6.9.7-3

Homebrew Formula patching old ImageMagick release 6.9.7-3

Install

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

Tested

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:
-- 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 September 2, 2015 20:55
Project Euler problem on in Elixir.
Enum.filter(1..999, fn(x) -> rem(x, 5) == 0 || rem(x, 3) == 0 end)
|> Enum.reduce(fn(x, acc) -> acc + x end)
# 233168