Skip to content

Instantly share code, notes, and snippets.

View imogenkinsman's full-sized avatar

Imogen Kinsman imogenkinsman

  • Portland, OR
View GitHub Profile
@imogenkinsman
imogenkinsman / Immutable-Performance.md
Last active May 8, 2022 04:49
JavaScript immutable array performance

index.ts

import Immutable from 'immutable';

// this transpiles to the same thing as testJS
const testTS = (arraySize: number): void => {
  const array: readonly number[] = Array(arraySize).fill(0);

  const t0 = performance.now();
@imogenkinsman
imogenkinsman / lastpass-cli-cheat-sheet.md
Last active November 9, 2020 20:03
lastpass-cli cheat sheet
Syntax Description
lpass login log in (initiates password prompt)
lpass show -c --password <amazon.com> copy password for to clipboard
lpass ls list all services
@imogenkinsman
imogenkinsman / pacman-cheat-sheet.md
Last active October 1, 2020 23:28
How To Use Pacman

This is my first Arch install and I keep forgetting or using unsafe pacman commands, so I made a thing.

Arch's philosophy is to be modular, give you control over everything, and allow you to shoot yourself in the foot every other day until you run out of toes.

This guide is meant to be used as a quick reference and prioritizes safe, sane defaults, but you should read the pacman docs first. They're a quick read, and will save you some pain later.

Pacman and Aur

Pacman only works with official repos - unofficial repos are listed in aur, the Arch Linux Repository. It's common to use yay, a wrapper that allows you to easily use both aur and the official repository:

@imogenkinsman
imogenkinsman / fizzbuzz.ex
Created September 30, 2017 18:01
fizzbuzz in elixir
defmodule FizzBuzz do
def run do
1..100
|> Enum.each(& print(&1))
end
defp print(n) when rem(n, 15) == 0 do
IO.puts("fizzbuzz")
end
" Vim color file
"
" Author: Tomas Restrepo <tomas@winterdom.com>
" https://github.com/tomasr/molokai
"
" Note: Based on the Monokai theme for TextMate
" by Wimer Hazenberg and its darker variant
" by Hamish Stuart Macpherson
"
execute pathogen#infect()
syntax on
filetype plugin indent on
colorscheme molokai
set t_Co=256
" https://github.com/kien/ctrlp.vim
set runtimepath^=~/.vim/bundle/ctrlp.vim
" use spaces instead of tabs
@imogenkinsman
imogenkinsman / cards_controller.rb
Created April 1, 2014 04:54
RABL testing example
class CardsController < ApplicationController
respond_to :json
def index
@cards = Card.all
end
end
@imogenkinsman
imogenkinsman / gist:8660653
Created January 28, 2014 01:11
define_method example
2.1.0 :013 > String.send(:define_method, :awesome) { "#{self} is awesome!" }
=> :awesome
2.1.0 :014 > "Ruby".awesome
=> "Ruby is awesome!"
require 'rspec/core/rake_task'
task :default => :spec
desc "Run the specs."
task :spec do
RSpec::Core::RakeTask.new do |t|
t.pattern = "spec/*/*_spec.rb"
end
end
@imogenkinsman
imogenkinsman / gist:6831326
Last active December 24, 2015 16:49
an example of caching
class Memcached
attr_writer :expiration
def initialize
@cache = {}
@expiration = Float::MAX
end
def set(key, &value)
@cache[key] = {value: value.call, time: Time.new}