This file contains 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
'.workspace, .workspace, .editor, .text-editor': | |
'cmd-s': 'window:save-all' # ctrl-s for Linux/Windows |
This file contains 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 ActiveModel | |
module Conversion | |
def to_partial_path | |
original_path = self.class._to_partial_path | |
parts = original_path.split('/') | |
return original_path if parts.length == 2 | |
pluralized_parts = parts[0..-3].map { |p| p.pluralize } | |
"#{pluralized_parts.join('/')}/#{parts.last(2).join('/')}".freeze | |
end | |
end |
This file contains 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
# lib/crud_responder.rb | |
module CrudResponder | |
include ActionView::Helpers::TextHelper | |
protected | |
def crud_respond(object, options = {}) | |
method = options.fetch(:method, method_by_caller(caller)) | |
success_url = options.fetch(:success_url) { default_redirect_url(method, object) } | |
error_action = options.fetch(:error_action) { default_render_action(method, object) } |
This file contains 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 Foo | |
def self.included base | |
base.send :extend, ClassMethods | |
end | |
module ClassMethods # the name doesn't matter as long as it match with line 3 | |
def bar | |
puts 'hello' | |
end | |
end |
This file contains 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
[GEM_ROOT]/gems/activesupport-4.2.4/lib/active_support/inflector/methods.rb:263 :in `const_get` | |
261 constant.const_get(name) | |
262 else | |
263 candidate = constant.const_get(name) | |
264 next candidate if constant.const_defined?(name, false) | |
265 next candidate unless Object.const_defined?(name) | |
[GEM_ROOT]/gems/activesupport-4.2.4/lib/active_support/inflector/methods.rb:263 :in `block in constantize` | |
[GEM_ROOT]/gems/activesupport-4.2.4/lib/active_support/inflector/methods.rb:259 :in `each` |
This file contains 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
Config dir is: /home/oleg/.config/reicast/ | |
Data dir is: /home/oleg/.local/share/reicast/ | |
Personality: 00000000 | |
Updated personality: 00000000 | |
Linux paging: 00001000 00001000 00000FFF | |
MAP 00800000 w/ 25165824 | |
MAP 20000000 w/ 25165824 | |
MAP 04000000 w/ 16777216 | |
MAP 06000000 w/ 16777216 | |
MAP 0C000000 w/ 0 |
This file contains 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/sh | |
NOTIFY_USER=oleg # optional, for kdialog | |
USER_DISPLAY=:0 # optional, for kdialog | |
LOCATION=`curl -I https://github.com/atom/atom/releases/latest | perl -n -e '/^Location: (.*)$/ && print "$1"'` | |
VERSION=`basename $LOCATION | perl -n -e '/(\d+.\d+.\d+)/ && print "$1"'` | |
echo "available version: $VERSION" | |
INSTALLED=`rpm -q atom | perl -n -e '/atom-(.*?)-/ && print "$1"'` |
This file contains 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
def normalize_volume(file) | |
output = `ffmpeg -i '#{file}' -af "volumedetect" -f null /dev/null 2>&1` | |
raise "Error getting audio volume from #{file} (#{$?})" unless $?.success? | |
max_volume = output.scan(/max_volume: ([\-\d\.]+) dB/).flatten.first | |
mean_volume = output.scan(/mean_volume: ([\-\d\.]+) dB/).flatten.first | |
return if !max_volume || !mean_volume | |
max_volume = max_volume.to_f | |
mean_volume = mean_volume.to_f | |
target_volume = -14.0 | |
adjustment = target_volume - mean_volume |
This file contains 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
/* ~/.mozilla/firefox/XXXXXX.default/chrome/userContent.css */ | |
input { | |
border: 2px inset white; | |
background-color: white; | |
color: black; | |
-moz-appearance: none !important; | |
} | |
textarea { | |
border: 2px inset white; |
This file contains 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
#!/usr/bin/env python | |
import ctypes | |
import wave | |
import sys | |
pa = ctypes.cdll.LoadLibrary('libpulse-simple.so.0') | |
PA_STREAM_PLAYBACK = 1 | |
PA_SAMPLE_S16LE = 3 |
OlderNewer