View battery_status_check.sh
#!/bin/bash
# To see available batteries run "upower -e"
BATTERY_PERCENTAGE=`upower -i /org/freedesktop/UPower/devices/DisplayDevice |grep percentage |awk -F: '{ print $2}' |awk -F% '{gsub(/ /, ""); print $1 }' |awk -F, '{ print $1 }'`
if [ $((BATTERY_PERCENTAGE)) -lt 10 ]; then
notify-send -u critical -c device -i /usr/share/icons/gnome/48x48/status/battery-low.png "Battery Level Low!" "%$BATTERY_PERCENTAGE"
fi
# Crontab entry:
View my-vim-plugins.vim
Plugin 'gmarik/Vundle.vim'
Bundle 'L9'
Plugin 'tpope/vim-dispatch'
Plugin 'tpope/vim-commentary'
Plugin 'tpope/vim-bundler'
Plugin 'tpope/vim-rails'
Plugin 'vim-ruby/vim-ruby'
View rubysnippets.vim
"
" Ruby snippets
" Last change: August 6 2007
" Version> 0.1.0
" Maintainer: Eustáquio 'TaQ' Rangel
" License: GPL
" Thanks to: Andy Wokula and Antonio Terceiro for help and patches.
"
if exists("b:rubysnippets_ignore")
finish
View gist:7a99ee5e759fd8e425ee15615bfeae8c
" An example for a vimrc file.
"
" Maintainer: Bram Moolenaar <Bram@vim.org>
" Last change: 2002 May 28
"
" To use it, copy it to
" for Unix and OS/2: ~/.vimrc
" for Amiga: s:.vimrc
" for MS-DOS and Win32: $VIM\_vimrc
" for OpenVMS: sys$login:.vimrc
View .tmux.conf
# $Id: vim-keys.conf,v 1.2 2010-09-18 09:36:15 nicm Exp $
#
# vim-keys.conf, v1.2 2010/09/12
#
# By Daniel Thau. Public domain.
#
# This configuration file binds many vi- and vim-like bindings to the
# appropriate tmux key bindings. Note that for many key bindings there is no
# tmux analogue. This is intended for tmux 1.3, which handles pane selection
# differently from the previous versions
View 20160318145525_convert_text_to_medium_in_post_and_page_translations.rb
class ConvertTextToMediumInPostAndPageTranslations < ActiveRecord::Migration
def up
change_column :post_translations, :text, :text, :limit => 64.kilobytes + 1
change_column :page_translations, :text, :text, :limit => 64.kilobytes + 1
end
def down
change_column :post_translations, :text, :text
change_column :page_translations, :text, :text
end
View boolean_store_accessor.rb
# File: app/models/concerns/boolean_store_accessor.rb
#
# When we submit a form in order to update a model, a booelan/checkbox field is posted
# as '1' or '0', and if we are using ActiveRecord::Store, posted value is stored in
# database as '1' or '0'. By the help of this module, we store '1' and '0'
# values as `true` or `false`.
#
# Example usage:
#
# ```
View apps_controller.rb
class Admin::AppsController < Admin::BaseController
before_filter :load_app
def index
@apps = App.all
end
def show
load_app
end
View download_remote_file.sh
FILE_TO_DOWNLOAD=`ssh ozgun@app1.dev 'ls -Art /tmp/dir |tail -n 1'`
scp ozgun@app1.dev:/tmp/dir/${FILE_TO_DOWNLOAD} .
View cards_controller.rb
class Dashboard::Payments::CardsController < ::Dashboard::Payments::BaseController
self.responder = Core::CustomServiceResponder
respond_to :html
before_action :customer_required
def destroy
service = Payments::Stripe::DeleteCreditCard.new(current_user)
status_object = service.call(params[:identifier])