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
puts File.read(ARGV[1]).force_encoding('Shift_JIS').encode('UTF-8', invalid: :replace, undef: :replace, replace: '').scan(/.:\\.*?\0/).map{|x| x.sub(/[^a-z0-9]*$/, '')}.uniq |
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
# Add the `native_enum` class method to your ApplicationRecord, like this, | |
# You can then use it in your model, and use postgres enum just like rails enum | |
# | |
# Eample: | |
# class Post < ApplicationRecord | |
# native_enum :status | |
# end | |
# | |
# Post.published.count => 0 | |
class ApplicationRecord < ActiveRecord::Base |
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
@function linear-calc($min, $max, $depend-expr, $depend-min, $depend-max) { | |
$range: $max - $min; | |
$grow-rate: $range / ($depend-max - $depend-min); | |
@return calc( | |
#{$min} + (#{$depend-expr} - #{$depend-min}) * #{$grow-rate} | |
); | |
} | |
$min-header-height: 40px; |
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
begin | |
require 'bundler/inline' | |
rescue LoadError => e | |
$stderr.puts 'Bundler version 1.10 or later is required. Please update your Bundler' | |
raise e | |
end | |
gemfile(true) do | |
source 'https://rubygems.org' | |
gem 'rails', '5.2.0' # use correct rails version |
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
# Chinese (China) translations for Devise 4.2.1 | |
# 4.2.0: By HealthGrid at https://gist.github.com/HealthGrid/2d702b38aa6ffe0233f27d3d5be9250f | |
# 4.2.1: By Artoria2e5 (this file) | |
# - Fixes pluralization problems (zh only takes "other") | |
# - Misc translation improvements, you know what these grammar things are. | |
# - Should be minor enough to claim CC0 for my changes. | |
# Additional translations at https://github.com/plataformatec/devise/wiki/I18n | |
zh-CN: | |
devise: |
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
# frozen_string_literal: true | |
source "https://rubygems.org" | |
gem "hashie" |
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
tell application "Google Chrome" | |
set need_delay to false | |
if not running then set need_delay to true | |
activate | |
if need_delay then delay 5 | |
end tell | |
tell application "System Events" | |
tell process "Google Chrome" | |
-- Click View |
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
#!/bin/bash | |
export DISPLAY=:0 | |
mate-screensaver-command -l | |
sleep 0.5 | |
sudo xset dpms force off |
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
$('#settings-tabs a[data-target]').click (e)-> | |
e.stopPropagation() | |
e.preventDefault() | |
history.pushState(null, null, $(this).attr('href')) | |
$('#settings-tabs .active').removeClass('active') | |
$(this).closest('li').addClass('active') | |
active_pane = $($(this).data('target')) | |
active_pane.closest('.tab-content').find('.tab-pane.active').removeC |
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
# ==== | |
# PoC: dot access to specific hash instance | |
# === | |
x = {a: 1, b:2} | |
# override method_missing | |
original_method_missing = x.method(:method_missing) | |
x.define_singleton_method :method_missing do|name, *args, &block| | |
return x[name] if x.key? name |
NewerOlder