Skip to content

Instantly share code, notes, and snippets.

View Masa331's full-sized avatar
🤠

Premysl Donat Masa331

🤠
View GitHub Profile
@Masa331
Masa331 / tag_hierarchy.rb
Last active September 19, 2020 13:48
Grouping text entries by associated tags into hierarchical structure by theirs occurence across entries
#!/usr/bin/env ruby
# Following is a code which groups some entries hierarchically by it's tags composition. The hierarchy is determined by tag occurence in other entries.
require 'pry'
# entry = [id, some text description, array of tags]
entries = [
[1, 'lorem ipsum', ['#customer_x', '#administration', '#paperwork']],
[2, 'lorem ipsum', ['#customer_x', '#development']],
@dhh
dhh / Gemfile
Created June 24, 2020 22:23
HEY's Gemfile
ruby '2.7.1'
gem 'rails', github: 'rails/rails'
gem 'tzinfo-data', '>= 1.2016.7' # Don't rely on OSX/Linux timezone data
# Action Text
gem 'actiontext', github: 'basecamp/actiontext', ref: 'okra'
gem 'okra', github: 'basecamp/okra'
# Drivers
@aonemd
aonemd / subtitle_extractor.rb
Last active March 7, 2022 14:05
A Ruby script to extract text from images with subtitles and rename the image file to the extracted text (requires Tesseract to be installed)
require 'pathname'
require 'open3'
require 'mini_magick'
SRC_DIR = '/path/to/src/dir/'.freeze
TMP_DIR = '/path/to/tmp/dir/'.freeze
class TextReader
def initialize(input_path, output_path)
@input_path = input_path
@sedadkosovac
sedadkosovac / turbolinks_scroll_persistence.js
Last active November 22, 2020 15:37
Turbolinks 5 Scroll Position Persistence
@junkycoder
junkycoder / vscode-react-patch.js
Last active September 9, 2018 11:19
Patch the `reactClassComponentPropTypes` snippet to define `propTypes` as static class property
#!/usr/bin/env node
/**
* Node.js script as patch method for vscode-react extension of 2.2.0 version.
*
* https://github.com/xabikos/vscode-react
* https://github.com/tc39/proposal-class-public-fields
*/
const fs = require('fs');
@amitmerchant1990
amitmerchant1990 / stylish.css
Last active March 26, 2021 02:21
Revert back to good old GitHub Homepage
/**
1. Install the Stylish(https://chrome.google.com/webstore/detail/stylish/fjnbnpbmkenffdnngjfgmeleoegfcffe?hl=en) extension for Chrome.
2. Open up extension options and paste the CSS mentioned below.
3. Specify the "URLs on the domain" to be `github.com`.
4. Add a title and save.
*/
.dashboard-sidebar {
float: right;
padding-right: 10px;
@alekseykulikov
alekseykulikov / index.md
Last active April 14, 2024 00:32
Principles we use to write CSS for modern browsers

Recently CSS has got a lot of negativity. But I would like to defend it and show, that with good naming convention CSS works pretty well.

My 3 developers team has just developed React.js application with 7668 lines of CSS (and just 2 !important). During one year of development we had 0 issues with CSS. No refactoring typos, no style leaks, no performance problems, possibly, it is the most stable part of our application.

Here are main principles we use to write CSS for modern (IE11+) browsers:

@yang-wei
yang-wei / destructuring.md
Last active July 4, 2024 16:56
Elm Destructuring (or Pattern Matching) cheatsheet

Should be work with 0.18

Destructuring(or pattern matching) is a way used to extract data from a data structure(tuple, list, record) that mirros the construction. Compare to other languages, Elm support much less destructuring but let's see what it got !

Tuple

myTuple = ("A", "B", "C")
myNestedTuple = ("A", "B", "C", ("X", "Y", "Z"))
@marick
marick / about_those_lava_lamps.md
Last active June 22, 2022 21:08
About Those Lava Lamps

Around 2006-2007, it was a bit of a fashion to hook lava lamps up to the build server. Normally, the green lava lamp would be on, but if the build failed, it would turn off and the red lava lamp would turn on.

By coincidence, I've actually met, about that time, (probably) the first person to hook up a lava lamp to a build server. It was Alberto Savoia, who'd founded a testing tools company (that did some very interesting things around generative testing that have basically never been noticed). Alberto had noticed that people did not react with any urgency when the build broke. They'd check in broken code and go off to something else, only reacting to the breakage they'd caused when some other programmer pulled the change and had problems.

@tmichel
tmichel / elm_sprockets.rb
Last active July 29, 2017 03:38
Elm Rails 4.2 integration (Sprockets 3.x)
# Elm integration for Sprockets 3.x (Rails 4.2)
#
# Revised version of a Sprockets 3.x processor for Elm. It supports
# dependencies. One little quirk is that only .js.elm files are
# requireable in application.js.
#
# How to use it?
#
# Put this file in your config/initializers/ and create
# app/assets/javascripts/MyModule.js.elm and require it in your