Skip to content

Instantly share code, notes, and snippets.

View dotemacs's full-sized avatar

Александар Симић dotemacs

View GitHub Profile
@dotemacs
dotemacs / gist:1519333
Created December 25, 2011 14:16
Превод
Emacs уџбеник. Услови копирања су на крају фајла.
Emacs команде обично користе CONTROL типку (некада означену као CTRL
или CTL) или META типку (некада означену као EDIT или ALT). У пракси
се користе следеће скраћенице за те типке:
C-<chr> значи стисни CONTROL типку док куцаш симбол <chr>.
Дакле, C-f означава: стисни CONTROL типку и укуцај f.
M-<chr> значи стисни META или EDIT или ALT типку док куцаш <chr>.
@dotemacs
dotemacs / gist:1524673
Created December 27, 2011 18:16
Install sqlite on FreeBSD
gem install sqlite3 -- --with-sqlite3-dir=/usr/local
(defun run-this-spec ()
"take the current buffer, if it's a RSpec example, switch to
eshell to run it"
(interactive)
(if (string-match "_spec\\.rb$" (buffer-file-name))
(let* ((current-buffer (buffer-file-name))
(path-to-the-spec
(replace-regexp-in-string (rinari-root) "" current-buffer)))
(progn
(defun dos2unix ()
(interactive)
(set-buffer-file-coding-system 'undecided-unix))
@dotemacs
dotemacs / clojure.md
Created April 16, 2012 22:27
Setting Up Clojure on OS X

Setting Up Clojure on OS X

I spent a lot of time trying to find a pretty optimal (for me) setup for Clojure… at the same time I was trying to dive in and learn it. This is never optimal; you shouldn't be fighting the environment while trying to learn something.

I feel like I went through a lot of pain searching Google, StackOverflow, blogs, and other sites for random tidbits of information and instructions.

This is a comprehensive "what I learned and what I ended up doing" that will hopefully be of use to others and act as a journal for myself if I ever have to do it again. I want to be very step-by-step and explain what's happening (and why) at each step.

I appreciate the effort you've put into documenting this, but there are a number of inaccuracies here that need to be addressed. We get

#!/bin/sh
if [ $# -lt 1 ]
then
echo
echo "Usage: $(basename $0) branch-name"
echo " where 'branch-name' is usually 'master'"
echo
exit
fi
@dotemacs
dotemacs / ip_address_validator.rb
Created September 16, 2012 21:28 — forked from geoffgarside/ip_address_validator.rb
Rails 3.x IP Address validator class
# The IP Address Validator accepts the following options
#
# * allow_nil - allows nil values
# * allow_blank - allows blank values
# * allow_cidr - allows /prefixlen CIDR masks in values
#
# the validator will use regular expressions in an attempt to prevent
# malformed IP addresses from being passed to the IPAddr.new initializer
# as this method can be very slow to raise exceptions for malformed input.
class IpAddressValidator < ActiveModel::EachValidator
Total size Compressed size
All archives 3542518737 2523193917
(unique data) 1791976985 1381930407
This archive 1962753905 1454292550
New data 388327262 386294579
@dotemacs
dotemacs / gist:4140327
Created November 24, 2012 16:12
add-to-mode function
(defun add-to-mode (mode &rest files)
"Turn on MODE's syntax highlighting for FILES
where FILES is either a file or a regular expression"
(dolist (file files)
(add-to-list 'auto-mode-alist (cons file mode))))
(add-to-mode 'ruby-mode
"\\.gem\\(rc\\|spec\\)$"
"\\.\\(irbrc\\|rake\\|ru\\)$"
"\\(Cap\\|Gem\\|Rake\\|Puppet\\|Vagrant\\)file$")
class AppDelegate
def application(application, didFinishLaunchingWithOptions:launchOptions)
@window = UIWindow.alloc.initWithFrame(UIScreen.mainScreen.bounds)
@window.makeKeyAndVisible
@window.rootViewController = RootController.new
@window.rootViewController.wantsFullScreenLayout = true
true
end
end