Skip to content

Instantly share code, notes, and snippets.

View mokolabs's full-sized avatar

Patrick Crowley mokolabs

View GitHub Profile
@mokolabs
mokolabs / git-add-ignore-space.sh
Created March 1, 2024 21:01 — forked from neilgoldman/git-add-ignore-space-at-eol.sh
Git Add But Ignore Whitespace
git diff -w --no-color | git apply --cached --ignore-whitespace
@mokolabs
mokolabs / sshpass.rb
Created September 20, 2019 16:17 — forked from lalyos/sshpass.rb
brew install sshpass
require 'formula'
class Sshpass < Formula
url 'http://sourceforge.net/projects/sshpass/files/sshpass/1.05/sshpass-1.05.tar.gz'
homepage 'http://sourceforge.net/projects/sshpass'
sha256 'c3f78752a68a0c3f62efb3332cceea0c8a1f04f7cf6b46e00ec0c3000bc8483e'
def install
system "./configure", "--disable-debug", "--disable-dependency-tracking",
"--prefix=#{prefix}"
@mokolabs
mokolabs / user.rb
Created May 26, 2011 02:49 — forked from ropiku/user.rb
If you need to support logging in via username and your usernames are case sensitive, use this.
def self.authenticate(email, password)
user = find(:first, :conditions => ['LOWER(username) = ? OR email = ?', email.to_s.downcase, email.to_s.downcase])
user && user.authenticated?(password) ? user : nil
end
def next_meeting(now=1.day.from_now)
if Chronic.parse("1st thursday of this month", :context => :past, :now => now)
return Chronic.parse('1st thursday of next month', :now => now)
else
return Chronic.parse("1st thursday of this month", :now => now)
end
end
##
# Calendar helper with proper events
# http://www.cuppadev.co.uk/webdev/making-a-real-calendar-in-rails/
#
# (C) 2009 James S Urquhart (jamesu at gmail dot com)
# Derived from calendar_helper
# (C) Jeremy Voorhis, Geoffrey Grosenbach, Jarkko Laine, Tom Armitage, Bryan Larsen
# Licensed under MIT. http://www.opensource.org/licenses/mit-license.php
##