Skip to content

Instantly share code, notes, and snippets.

View Beyarz's full-sized avatar
💎
Searching for Ruby gems

Beyar Beyarz

💎
Searching for Ruby gems
  • Sweden
  • 19:23 (UTC +02:00)
View GitHub Profile
@Beyarz
Beyarz / &.rb
Last active May 30, 2023 20:35
Ruby shorthands shortcut
# &, optional chainig
[1,2,3,4,5,6][5]&.to_s
=> "6"
[1,2,3,4,5,6][6]&.to_s
=> nil
# &, map shorthand notation
to_s = Proc.new { |x| x.to_s }
=> #<Proc:0x00000001065bdef0 (irb):8>
[1,2,3].map &to_s
@Beyarz
Beyarz / run.sh
Created June 12, 2022 18:47
Githubs superlinter
docker run -e RUN_LOCAL=true -v $PWD:/tmp/lint github/super-linter
@Beyarz
Beyarz / yabairc
Created June 3, 2022 13:46
.config/yabai/yabairc
#!/usr/bin/env sh
# global settings
yabai -m config mouse_follows_focus off
yabai -m config focus_follows_mouse off
yabai -m config window_origin_display default
yabai -m config window_placement second_child
yabai -m config window_topmost off
yabai -m config window_shadow on
yabai -m config window_opacity off
@Beyarz
Beyarz / skhdrc
Created June 3, 2022 12:33
.config/skhd/skhdrc
# fn - hjkl > arrow keys
fn - k: skhd -k up
fn - h: skhd -k left
fn - l: skhd -k right
fn - j: skhd -k down
# Terminal
# cmd + t
# Firefox
@Beyarz
Beyarz / netstat.sh
Last active May 9, 2022 20:25
netstat open ports
# See open ports
netstat -ant | grep LISTEN
@Beyarz
Beyarz / devurls.js
Last active April 23, 2022 12:07
devurls.com filter by day
// ==UserScript==
// @name Filter
// @version 1.0
// @description Filter by day
// @author You
// @match https://devurls.com
// @icon https://www.google.com/s2/favicons?sz=64&domain=devurls.com
// @grant none
// ==/UserScript==
@Beyarz
Beyarz / dashboard.rb
Created March 27, 2022 21:16
Live updates from sinatra server via hotwired stimulus
# frozen_string_literal: true
# rubocop:disable Metrics/BlockLength
require 'date'
require 'sinatra'
require 'sinatra/reloader' if development?
set :port, 3020
set :bind, '0.0.0.0'
@Beyarz
Beyarz / stimulus.html
Last active March 17, 2022 00:45
StimulusJS on CDN
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Stimulus</title>
<script type="module">
import {
Application,
@Beyarz
Beyarz / vsco.rb
Last active March 16, 2022 12:34
Download all the images from a user on https://vsco.co
# frozen_string_literal: true
# rubocop:disable Layout/LineLength
require 'net/https'
require 'ruby-cheerio'
require 'json'
require 'cgi'
require 'open-uri'
# Pick your target here
@Beyarz
Beyarz / run.md
Created March 12, 2022 19:33
Enable devtool on macOS native windows
defaults write NSGlobalDomain WebKitDeveloperExtras -bool true
defaults write -g WebKitDeveloperExtras -bool YES