Skip to content

Instantly share code, notes, and snippets.

View Thorsson's full-sized avatar
🎯
Focusing

Ivan Turkovic Thorsson

🎯
Focusing
View GitHub Profile
function work {
if [ -z "$1" ]; then
cd ~/Projects/ && ls
else
project=~/Projects/$1
if [ -d $project ]; then
cd $project;
osascript 2>/dev/null <<EOF
tell application "Terminal"
activate
@Thorsson
Thorsson / vim-shortcuts.md
Created December 9, 2022 21:09 — forked from tuxfight3r/vim-shortcuts.md
VIM SHORTCUTS

VIM KEYBOARD SHORTCUTS

MOVEMENT

h        -   Move left
j        -   Move down
k        -   Move up
l        -   Move right
$        -   Move to end of line
0        -   Move to beginning of line (including whitespace)
@Thorsson
Thorsson / README.md
Created October 16, 2022 20:26 — forked from subfuzion/README.md
vim/neovim configuration

I recently switched over to neovim (see my screenshots at the bottom). Below is my updated config file.

It's currently synchronized with my .vimrc config except for a block of neovim-specific terminal key mappings.

This is still a work in progress (everyone's own config is always a labor of love), but I'm already extremely pleased with how well this is working for me with neovim. While terminal mode isn't enough to make me stop using tmux, it is quite good and I like having it since it simplifies my documentation workflow for yanking terminal output to paste in a markdown buffer.

These days I primarily develop in Go. I'm super thrilled and grateful for fatih/vim-go,

{
"ChainName": "Dogechain",
"chainId": 2000,
"homesteadBlock": 0,
"daoForkSupport": true,
"eip150Block": 0,
"eip150Hash": "0x0000000000000000000000000000000000000000000000000000000000000000",
"eip155Block": 0,
"byzantiumBlock": 0,
"constantinopleBlock": 0,
{
"ChainName": "Dogechain",
"chainId": 2000,
"homesteadBlock": 0,
"daoForkSupport": true,
"eip150Block": 0,
"eip150Hash": "0x0000000000000000000000000000000000000000000000000000000000000000",
"eip155Block": 0,
"byzantiumBlock": 0,
"constantinopleBlock": 0,
{
"name": "Dogechain",
"genesis": {
"nonce": "0x0000000000000000",
"timestamp": "0x0",
"extraData": "0x0000000000000000000000000000000000000000000000000000000000000000f858f85494d668bba507d0438ff22ee8ceb341323765669a24947175996ff9dcb8fbb83b68e2b88f1a029014555b9492bb5d1a856e54157232b43fe1c9c7e89ee36abe9464f2686e3ac7492c3b3f662d32ecb8b6bfa548fe80c0",
"gasLimit": "0x1c9c380",
"difficulty": "0x1",
"mixHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
"coinbase": "0x0000000000000000000000000000000000000000",
@Thorsson
Thorsson / a_rails_rspec_checklist\README.md
Created February 13, 2021 13:17 — forked from BideoWego/a_rails_rspec_checklist\README.md
Rails Spec setup checklist, helper and support files

Rails RSpec Checklist

  • Ensure turbolinks is disabled for good measure

    • comment out gem
    • remove from javascript asset pipeline
    • remove from application layout
  • Add the following gems to Gemfile in a development, test group

    • hirb
@Thorsson
Thorsson / README.md
Created November 25, 2020 19:35 — forked from jesster2k10/README.md
JWT Auth + Refresh Tokens in Rails

JWT Auth + Refresh Tokens in Rails

This is just some code I recently used in my development application in order to add token-based authentication for my api-only rails app. The api-client was to be consumed by a mobile application, so I needed an authentication solution that would keep the user logged in indefinetly and the only way to do this was either using refresh tokens or sliding sessions.

I also needed a way to both blacklist and whitelist tokens based on a unique identifier (jti)

Before trying it out DIY, I considered using:

@Thorsson
Thorsson / active_record_marshalable.rb
Created April 2, 2019 14:40 — forked from keichan34/active_record_marshalable.rb
Get Marshal.dump and Marshal.load to load cached association objects ( Whatever.includes(:example_models) ), as well.
module ActiveRecordMarshalable
def marshal_dump
[attributes, self.association_cache, instance_variable_get(:@new_record)]
end
def marshal_load data
send :initialize, data[0]
instance_variable_set :@association_cache, data[1]
instance_variable_set :@new_record, data[2]
end
@Thorsson
Thorsson / redux-orm-normalization.js
Created February 2, 2019 20:57 — forked from markerikson/redux-orm-normalization.js
Redux-ORM nested data normalization
import {fk, many, Model} from 'redux-orm';
class Book extends Model {
static get fields() {
authors: many('Author', 'books'),
publisher: fk('Publisher', 'books'),
}
static parse(data) {
/*