Instance | Branch |
---|
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
SB_ACCOUNT = ['USERNAME', 'PASSWORD'] | |
GM_ACCOUNT = ['USERNAME', 'PASSWORD'] | |
BOXCAR_ADDR = "123456.123456@push.boxcar.io" | |
sb.select 'INBOX' | |
imap_each(sb, %w(UNDELETED)) do |mail, m| | |
Net::SMTP.start('127.0.0.1', 25) {|smtp| smtp.send_mail mail.attr['BODY[HEADER]'], m[:from], BOXCAR_ADDR} | |
gm.append 'INBOX', m[:src], nil, m[:date] | |
sb.store mail.seqno, '+FLAGS', [:Deleted] | |
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
(defadvice ruby-indent-line (after unindent-closing-paren activate) | |
(let ((column (current-column)) | |
indent offset) | |
(save-excursion | |
(back-to-indentation) | |
(let ((state (syntax-ppss))) | |
(setq offset (- column (current-column))) | |
(when (and (eq (char-after) ?\)) | |
(not (zerop (car state)))) | |
(goto-char (cadr state)) |
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
Made an update covering Macos 10.8 and ruby 2.0: https://gist.github.com/michaelsd/5224456 | |
- Install "Command Line Tools for XCode" (Get it from Apple Developer Program) or Install XCode via Appstore | |
where option one is the faster one, 170MB vs 1.xGB | |
- Install https://github.com/sstephenson/rbenv | |
git clone into your home folder; | |
set environment variables, see install docs of rbenv; | |
- Get libyaml |
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 ruby | |
cols = (ARGV[0] || 5).to_i - 1 | |
rows = (ARGV[1] || 9).to_i | |
begin | |
table = (0...rows).map do |i| | |
(0...cols).map { rand(2) }.join | |
end | |
end until table.join =~ /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
# We have to remove validations on email, as it's no longer needed. | |
# Based on a solution found at http://stackoverflow.com/questions/7545938/how-to-remove-validation-using-instance-eval-clause-in-rails | |
Model.class_eval do | |
_validators.reject!{ |key, _| key == :field } | |
_validate_callbacks.each do |callback| | |
callback.raw_filter.attributes.delete :field | |
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
diff --git configure.ac configure.ac | |
index 62f53a3..850eaa4 100644 | |
--- configure.ac | |
+++ configure.ac | |
@@ -1571,7 +1571,7 @@ if test "${HAVE_NS}" = yes; then | |
leimdir="\${ns_appresdir}/leim" | |
INSTALL_ARCH_INDEP_EXTRA= | |
fi | |
- NS_OBJC_OBJ="nsterm.o nsfns.o nsmenu.o nsselect.o nsimage.o nsfont.o" | |
+ NS_OBJC_OBJ="nsterm.o nsfns.o nsmenu.o nsselect.o nsimage.o nsfont.o macim.o" |
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
$ sudo gem install --no-rdoc --no-ri mysql2 --version 0.2.11 -- --with-mysql-dir=/usr/local/mysql --with-mysql-config=/usr/local/mysql/bin/mysql_config | |
Building native extensions. This could take a while... | |
ERROR: Error installing mysql2: | |
ERROR: Failed to build gem native extension. | |
/Users/hubb/.rbenv/versions/1.9.3-p0/bin/ruby extconf.rb --with-mysql-dir=/usr/local/mysql-5.6.11-osx10.7-x86_64 --with-mysql-config=/usr/local/mysql-5.6.11-osx10.7-x86_64/bin/mysql_config --with-opt-include=/usr/local/mysql-5.6.11-osx10.7-x86_64/include | |
checking for rb_thread_blocking_region()... yes | |
checking for mysql.h... no | |
checking for mysql/mysql.h... no | |
----- |
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
<?php | |
App::uses('CakeEmail', 'Network/Email'); | |
class AppCakeEmail extends CakeEmail { | |
protected $_emailPattern = null; | |
/** | |
* |
Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.
$ python -m SimpleHTTPServer 8000
OlderNewer