Skip to content

Instantly share code, notes, and snippets.

View pucinsk's full-sized avatar
🖐️

Jokūbas pucinsk

🖐️
View GitHub Profile
@pucinsk
pucinsk / .aerospace.toml
Created February 12, 2025 10:04
Aerospace config
# Start AeroSpace at login
start-at-login = true
# Normalizations. See: https://nikitabobko.github.io/AeroSpace/guide#normalization
enable-normalization-flatten-containers = true
enable-normalization-opposite-orientation-for-nested-containers = true
# See: https://nikitabobko.github.io/AeroSpace/guide#layouts
# The 'accordion-padding' specifies the size of accordion padding
# You can set 0 to disable the padding feature
accordion-padding = 30
@pucinsk
pucinsk / rails_template.rb
Last active June 6, 2025 04:38
Ruby on Rails template which focuses on installing whole rubocop suite and preconfigures it with opinioted style instead of using rails omakase setup.
### README FIRST
# RuboCop:
# This template replaces rails rubocop omakase with it's own rubocop config
# Please use "--skip-rubocop" flag
gem_group :development, :test do
gem "factory_bot_rails"
gem "faker"
gem "rspec-rails"
gem "rubocop"
const envName = altair.helpers.getEnvironment('envName')
const tokenKey = `${envName}:csrfToken`
// Uncomment This to fetch new csrf token
// ----
// const regex = /<meta name="csrf-token" content="\S+" \/>/gm;
// const url = altair.helpers.getEnvironment('url')
// const csrfDomStr = await fetch(url).then(response=>response.text())
@pucinsk
pucinsk / README.md
Last active November 21, 2022 12:54
Disconnect/Connect Bluetooth devices on Mac Sleep/Wake | blueutil | Hammerspoon | zsh | Caffeine | Thank you https://manojkarthick.com/posts/2022/01/disconnect-bluetooth-lid-close/
@pucinsk
pucinsk / awesome_sort.rb
Last active September 23, 2022 09:12
Pure Ruby sort - for sorting arrays of hashes by keys in asc or desc order
class AwesomeSort
class Sortee
def initialize(sortee)
@sortee = sortee
end
def by(*args, **kwargs)
sort(args.map { |it| [it, :asc] }.to_h.merge(kwargs))
end
@pucinsk
pucinsk / keybindings.tmux
Created May 12, 2022 06:18
Byobu keyboard shortcuts override - feels more iTerm'ish now
unbind-key -n C-a
set -g prefix ^A
set -g prefix2 F12
bind a send-prefix
unbind-key -n F2
bind-key -n M-t new-window -c "#{pane_current_path}" \; rename-window "-"
unbind-key -n C-F2
bind-key -n M-d display-panes \; split-window -h -c "#{pane_current_path}"
unbind-key -n S-F2
@pucinsk
pucinsk / AwesomeDrawer.js
Created February 11, 2021 22:20
React Material UI 'drawer-like' component which can be rendered from container.
import React, { useMemo, forwardRef, useState, useEffect } from 'react'
import PropTypes from 'prop-types'
import { makeStyles, Paper, Slide, ClickAwayListener } from '@material-ui/core'
const useStyles = makeStyles(function (theme) {
return (
{
root: {
backgroundColor: theme.palette.background.paper,
flexGrow: 1,
@pucinsk
pucinsk / dummy_has_many.rb
Created October 25, 2020 12:08
Fake ActiveRecord `has_many` association. Of course, if you have enough fantasy, you can convert it to `has_one` or whatever.
module DummyRelations
def has_many(relation_name)
class_eval do
define_method(relation_name) do
instance_variable_get("@#{relation_name}") || []
end
define_method("#{relation_name}=") do |value|
instance_variable_set("@#{relation_name}", Array(value))
end
import React from 'react'
import ReactDOM from 'react-dom'
import { Router, Route } from 'react-router-dom'
import Dashboard from '../src/pages/Dashoard'
import Login from '../src/pages/Login'
const ReactiveDashboard = () => (
<Router>
<Route path='/login' component={Login} />
<Route exact path='/' component={Dashboard} />
@pucinsk
pucinsk / rails_webpacker_bootstrap_expose_jquery.md
Created November 13, 2018 19:57 — forked from andyyou/rails_webpacker_bootstrap_expose_jquery.md
Rails 5.2 with webpacker, bootstrap, stimulus starter

Rails 5.2 with webpacker, bootstrap, stimulus starter

This gist will collect all issues we solved with Rails 5.2 and Webpacker

Create Project

# Last few parameters(--skip-* part) is only my habbit not actully required
$ rails new <project_name> --webpack=stimulus --database=postgresql --skip-coffee --skip-test