Skip to content

Instantly share code, notes, and snippets.

View jaynetics's full-sized avatar

Janosch Müller jaynetics

View GitHub Profile
@premek
premek / mv.sh
Last active March 5, 2024 17:43
Rename files in linux / bash using mv command without typing the full name two times
# Put this function to your .bashrc file.
# Usage: mv oldfilename
# If you call mv without the second parameter it will prompt you to edit the filename on command line.
# Original mv is called when it's called with more than one argument.
# It's useful when you want to change just a few letters in a long name.
#
# Also see:
# - imv from renameutils
# - Ctrl-W Ctrl-Y Ctrl-Y (cut last word, paste, paste)
@ixti
ixti / gemfile-upgrade-plan.rb
Last active December 28, 2022 18:47
Small script that to print CSV that can be used to plan gem upgrades
# frozen_string_literal: true
require "bundler/inline"
require "csv"
STDOUT.sync = STDERR.sync = true
gemfile do
source "https://rubygems.org"
gem "http"
@pirj
pirj / repl.rb
Created February 23, 2019 10:31
Ruby REPL when `pry` is not there
while(true) do
begin
print '> '
input = STDIN.readline.chop
output = eval(input)
puts "=> #{output}"
rescue StandardError => e
puts "Error: #{e.message}"
end
end
@igorkasyanchuk
igorkasyanchuk / gist:615f22516e2a4de359eda7a1135df0b4
Last active March 13, 2022 10:33
diff using paper trail and diff gem
Gemfile
gem 'paper_trail'
gem 'diffy'
gem 'activerecord-diff'
# view
= title "Logs"
@iloveitaly
iloveitaly / capybara_fill_stripe_elements.rb
Created March 4, 2017 21:21
Fill in a Stripe Elements (https://stripe.com/docs/elements) credit card field using capybara
def fill_stripe_elements(card)
using_wait_time(15) { within_frame('stripeField_card_element0') do
card.to_s.chars.each do |piece|
find_field('cardnumber').send_keys(piece)
end
find_field('exp-date').send_keys("0122")
find_field('cvc').send_keys '123'
find_field('postal').send_keys '19335'
end }
@lmarkus
lmarkus / README.MD
Last active May 2, 2024 09:21
Extracting / Exporting custom emoji from Slack

Extracting Emoji From Slack!

Slack doesn't provide an easy way to extract custom emoji from a team. (Especially teams with thousands of custom emoji) This Gist walks you through a relatively simple approach to get your emoji out.

If you're an admin of your own team, you can get the list of emoji directly using this API: https://api.slack.com/methods/emoji.list. Once you have it, skip to Step 3

HOWEVER! This gist is intended for people who don't have admin access, nor access tokens for using that list.

Follow along...

@pirj
pirj / ruby-block-sugar.asciidoc
Last active July 29, 2022 14:19
Ruby block sugar

You won’t find rants on how functional programming improves you, your sanity and your life overall here. There are some examples in the very beginning to save you some time on reading the whole post, just come along if you don’t like how they look like.

By the way, this is not even a blog, so formally this is not even a blog post. This is not a library or a new paradigm. It’s just a few pieces of code that might come handy for your daily job.

Example:

[1, 3.14, -4].map &_.safe{ magnitude odd? } # => [true, nil, false]
@gtallen1187
gtallen1187 / scar_tissue.md
Created November 1, 2015 23:53
talk given by John Ousterhout about sustaining relationships

"Scar Tissues Make Relationships Wear Out"

04/26/2103. From a lecture by Professor John Ousterhout at Stanford, class CS142.

This is my most touchy-feely thought for the weekend. Here’s the basic idea: It’s really hard to build relationships that last for a long time. If you haven’t discovered this, you will discover this sooner or later. And it's hard both for personal relationships and for business relationships. And to me, it's pretty amazing that two people can stay married for 25 years without killing each other.

[Laughter]

> But honestly, most professional relationships don't last anywhere near that long. The best bands always seem to break up after 2 or 3 years. And business partnerships fall apart, and there's all these problems in these relationships that just don't last. So, why is that? Well, in my view, it’s relationships don't fail because there some single catastrophic event to destroy them, although often there is a single catastrophic event around the the end of the relation

@tuxfight3r
tuxfight3r / 01.bash_shortcuts_v2.md
Last active May 2, 2024 09:06
Bash keyboard shortcuts

Bash Shortcuts

visual cheetsheet

Moving

command description
ctrl + a Goto BEGINNING of command line
@julionc
julionc / 00.howto_install_phantomjs.md
Last active April 26, 2024 09:13
How to install PhantomJS on Debian/Ubuntu

How to install PhantomJS on Ubuntu

Version: 1.9.8

Platform: x86_64

First, install or update to the latest system software.

sudo apt-get update
sudo apt-get install build-essential chrpath libssl-dev libxft-dev