https://gist.github.com/ziadoz/3e8ab7e944d02fe872c3454d17af31a5
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# .lefthook.yml | |
# 1) Define a “common” map of commands | |
.common: &common_commands | |
check_clean: | |
run: | | |
if [ -n "$(git status --porcelain)" ]; then | |
echo "❌ Uncommitted changes detected. Please commit or stash before pushing." | |
exit 1 | |
fi |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script> | |
$(document).on('turbolinks:before-cache', function(e) { | |
$('.form-control.select2, .form-control.select2-taggable, .form-control.select2-w-100').each(function() { | |
if ($(this).data('select2')) { | |
$(this).select2('destroy'); | |
} | |
}); | |
}); | |
$('.form-control.select2, .form-control.select2-taggable, .form-control.select2-w-100').each(function() { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module PrettyHelper | |
def pretty_boolean(boolean) | |
boolean ? "Yes" : "No" | |
end | |
def pretty_array(array, seperator: ";") | |
array.to_a.join("; ") | |
end | |
def pretty_linked_record_array(array, field, new_window: true) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# https://github.com/Shopify/erb-lint | |
linters: | |
DeprecatedClasses: | |
enabled: true | |
FinalNewline: | |
enabled: true | |
ErbSafety: | |
enabled: true | |
exclude: | |
- '**/node_modules/**' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* global $, HandlebarsTemplates */ | |
// For use with https://github.com/leshill/handlebars_assets | |
function renderTemplate(template, context) { | |
return HandlebarsTemplates[template](context) | |
} | |
function renderTemplateAt(query, template, context) { | |
return ( | |
$(query).html( | |
renderTemplate(template, context) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Note: Must use `var self = this` to access stuff within the success/error functions | |
Rails.ajax({ | |
url: action_path, | |
type: "PATCH", | |
data: $.param(data), | |
dataType: 'script', | |
processData: false, | |
contentType: false, | |
success: function(data) { }, | |
error: function(data) { } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This is a very simple hash based graph utility class. | |
# By Mykl Clason | |
# https://gist.github.com/MyklClason/fe603a6005a1dedc6ec65fda7ff47f68 | |
class Graph | |
def self.undirected_graph_from_edges(edges) | |
# Edges are (a,b) pairs with a => b and b => a relationships. | |
edges.each_with_object(Hash.new { |h, k| h[k] = Set.new }) { |(k, v), h| h[k] << v } | |
end | |
def self.directed_graph_from_edges(edges) |
https://yarnpkg.com/lang/en/docs/install/#debian-stable
Run Commands
curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -
echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list
sudo apt-get update && sudo apt-get install --no-install-recommends yarn
NewerOlder