Skip to content

Instantly share code, notes, and snippets.

@cu39
cu39 / mouse-4-and-5-for-reloading.json
Created April 3, 2022 08:03
Safariでマウスボタン4/5をリロードボタンに設定するKarabiner-Elementsルール
{
"title": "マウスボタン4/5でリロード(Safari限定)",
"rules": [
{
"description": "マウスボタン4でリロード(Safari限定)",
"manipulators": [
{
"type": "basic",
"from": {
"pointing_button": "button4"
@cu39
cu39 / feedbro-locale-ja_JP.json
Created January 9, 2022 12:58
Feedbro Locale ja_JP 日本語ロケール
{
"meta": {
"manifest_version": 1,
"locale_version": "1.0",
"locale_name": "English",
"locale_type": "en_US",
"locale_last_updated": "2019-10-18 12:00:00 UTC",
"locale_author_name": "Nodetics",
"locale_author_email": "nodetics@gmail.com",
"locale_source_url": "https://nodetics.com/feedbro/"
@cu39
cu39 / .gitignore
Last active January 13, 2017 05:29
textlint-prh-regex-lookahead
node_modules/
@cu39
cu39 / dom_walkaround.jsx
Last active December 12, 2016 14:28
【InDesign】DocumentからスタートしてDocumentまで戻る【DOM散歩】 ref: http://qiita.com/cu39/items/3f8b857f2d03c7e6163e
var doc = app.activeDocument;$.writeln( doc ===
app.activeDocument // Document
.stories // Stories
.item(0) // Story
.paragraphs // Paragraphs
.item(0) // Paragraph
.parentTextFrames[0] // TextFrame (item() does not exist)
.parent // Page
.parent // Spread
.parent // Document
@cu39
cu39 / pwgen
Last active January 2, 2016 08:59
Random string generator on shell
#!/usr/bin/env bash
# ref http://d.hatena.ne.jp/pasela/20120710/random
usage() {
cat << EOF
Usage: ${0##*/} [-l letter_set] [-w word_num] [-n number_of_passwords]
Generates random letters for password.
OPTIONS:
@cu39
cu39 / sass_sourcemap.rb
Created July 4, 2013 16:01
Sass::Engine#render_with_sourcemap
# coding: utf-8
require 'sass' # 3.3.0.alpha136
abs_dir = File.expand_path '..', __FILE__
sass_path_rel = 'views/application.sass'
sass_path_abs = File.join abs_dir, sass_path_rel
css_path_rel = 'css/application.css'
class BlockConf
CONF_NAMES = [:id, :pw]
CONF_NAMES.each do |name|
define_method name { |v| @conf[name] = v }
end
def self.configure &blk
self.new &blk
end
@cu39
cu39 / instance_config_in_dsl.rb
Created May 25, 2013 07:28
Tell the constructor new settings in your own DSL. `WhateverService` is a toplevel module whose `configure` method returns `WhateverService::Client` when a block passed. This config block is going to be `instance_eval`-ed in `WhateverService::Client`'s constructor. You can also pass a hash to the `WhateverService::Client`'s constructor.
$: << '.'
require 'whatever_service'
wsc1 = WhateverService.configure do
user_id 'foo'
password 'bar_baz'
end
wsc2 = WhateverService::Client.new(:user_id => 'baz', :password => 'foo_bar')
@cu39
cu39 / color_scheme.less
Created May 14, 2013 06:35
Defines color scheme half-automatically.
// Hue : 0-360
// Saturation : 0-100%
// Lightness : 0-100%
@clr_primary : hsl(0, 70%, 50%);
@clr_spin_deg : 120;
@clr_lighten_deg : 20%;
@clr_darken_deg : 20%;
@clr_saturate_deg : 20%;
@clr_desaturate_deg : 20%;
@cu39
cu39 / four-parents.sh
Last active November 3, 2015 10:02
Create a git repo whose last commit has four parents
#!/bin/sh
GIT=$(which git)
TARGET_DIR="four-parents"
if [[ -d $TARGET_DIR ]]; then
echo $TARGET_DIR already exists.
exit 1
fi