Convenient CLI and GUI for adjusting the brightness on my Ubuntu installation in my Thinkpad T440
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 for PS2 Barracuda 1 | |
# buttons are: X A B Y L2 R2 L1 R1 sel start | |
COMMON | |
-X | |
-dev /dev/input/js0 | |
-thresh -32767 32767 -32767 32767 -32767 32767 -32767 32767 -32767 32767 -32767 32767 | |
-axis Left Right Up Down Left Right Up Down Left Right Up Down | |
-buttons S X Z A D C D C ShiftR Return |
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/bash | |
# check for -f flag as first argument; if present, bypass all restrictions | |
if [[ "$1" == "-f" ]]; then | |
shift | |
git-commit "$@" | |
exit 0 | |
fi | |
fail() |
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
# Run this file with the following: | |
# curl https://gist.github.com/Vaselinessa/7565683/raw/f175a61e61015276476448f917e914700e68cace/hosts.bat | cmd | |
@echo off | |
set output=c:\windows\system32\drivers\etc\hosts | |
echo %output% | |
echo. >> %output% | |
echo # Inserted by Markham's script 20-11-2013 >> %output% |
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
=begin | |
Usage: | |
require 'audit_logger' | |
class MyClass | |
include AuditLogger::Helpers | |
audit_logger_name 'my-class.log' | |
# It works in instance methods |
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
hardstatus alwayslastline | |
hardstatus string '%{= kg}[ %{G}%H %{g}][%= %{=kw}%?%-Lw%?%{r}(%{W}%n*%f%t%?(%u)%?%{r})%{w}%?%+Lw%?%?%= %{g}][%{B}%Y-%m-%d %{W}%c %{g}]' | |
vbell off |
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
# Functions to handle integration of x-editable w/ select2 w/ ajax source. | |
# Usage is as follows: | |
# <a href='#' id='elem' data-type='select2' data-name='template_id' data-url='/crm/task_builders/4' data-id=4></a> | |
# <script> | |
# $('#elem').editableSelect2Templates(); | |
# </script> | |
do () -> | |
# Convenience method for adding x-editable + select2 behaviour to an <a>. | |
# Options include queryUrl, url, params, send, placeholder, allowClear, minimumInputLength, query, data, displayKey |
You must do three things to get the better_errors gem's error pages to link successfully to Sublime Text 2 on Windows:
- set BetterErrors.editor
- build a batch file to reformat the path that better_errors supplies into a Windows file path
- make a registry key to handle the protocol 'subl'
In your rails projects initializes directory, add a single file (call it whatever you want; I called it better_errors.rb) whose contents is:
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
=begin | |
The purpose of this patch is to make pseudo-date accessor and mutator methods. | |
So if you have a date field :red_letter on a class MyClass, | |
calling MyClass::pseudo_date_accessor(:red_letter, prev:true) can generate useful methods | |
:years_since_red_letter | |
:years_since_red_letter= | |
calling MyClass::pseudo_date_accessor(:red_letter, next:true) generates | |
:years_until_red_letter |
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 ActionView | |
module Helpers | |
class FormBuilder | |
# Make a field whose class includes 'date' and whose value can be custom-formatted | |
def date_field method, options={} | |
date = self.object.send(method).to_date | |
options[:value] = options.has_key?(:format) ? date.strftime(options[:format]) : date.to_s | |
options[:class].is_a?(String) ? options[:class] += ' date' : options[:class] = 'date' | |
rescue |