Skip to content

Instantly share code, notes, and snippets.

View aladac's full-sized avatar

Adam Ladachowski aladac

View GitHub Profile
@aladac
aladac / .vimrc
Created March 26, 2012 09:41
Time Indexed Autobackup
au! BufWrite * let &backupext = strftime(".%y%m%d.%H%M%S")
@aladac
aladac / vidcap.sh
Created March 27, 2012 09:22
Video Capture using Xvidcap
xvidcap --gui no --quality 100 \
--cap_geometry 800x600 --format mov --audio no
@aladac
aladac / hint_vid_mode.sh
Created March 27, 2012 13:04
Hint Video Mode for VirtualBox
VBoxManage controlvm "VM_NAME" setvideomodehint 854 480 32
@aladac
aladac / vid_mode_switch.sh
Created March 27, 2012 13:06
Video mode switch for VirtualBox w/o guest additions
VBoxManage setextradata "VM_NAME" CustomVideoMode1 854x480x32
class Bounty
include Mongoid::Document
embeds_many :kills
validates_uniqueness_of :ts, :scope => [ :char_id ]
validates_presence_of :ts, :char_id, :bounty
field :ts, type: Time
field :char_id, type: Integer
field :corp_id, type: Integer
field :tax, type: Integer
field :bounty, type: Integer
#!/usr/bin/env ruby
# A script to show number of workdays and work hours in a month, named in honor of the Warcraft Peon unit
require 'date'
require "optparse"
options = { hours: 8 }
OptionParser.new do |opts|
opts.banner = "Usage: #{$0} [options]"
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>URL</key>
<string>vnc://192.168.1.143</string>
</dict>
</plist>
@aladac
aladac / noreferrer.js
Created October 28, 2014 11:32
What is the most reliable way to hide / spoof the referrer in JavaScript?
// Source: http://stackoverflow.com/questions/8893269/what-is-the-most-reliable-way-to-hide-spoof-the-referrer-in-javascript
var isWebkit = document.createElement("a");
isWebkit.style.cssText = "-webkit-border-radius:1px;";
isWebkit = isWebkit.style.cssText.indexOf("radius") !== -1;
if (isWebkit) {
function hideRefer(e) {
var a = e.target;
if (a && a.tagName !== 'A') a = a.parentNode;
@aladac
aladac / ruby-singleton.rb
Created December 5, 2018 11:14
Ruby Singleton
module Sample
class << self
def foobar
end
end
end
@aladac
aladac / activesupport-concern.rb
Created December 5, 2018 11:16
Rails ActiveSupport Concern
module Sample
extend ActiveSupport::Concern
included do
scope :disabled, -> { where(disabled: true) }
end
class_methods do
...
end