Skip to content

Instantly share code, notes, and snippets.

View behrangsa's full-sized avatar
💾

Behrang Saeedzadeh behrangsa

💾
View GitHub Profile
@behrangsa
behrangsa / pom.xml
Created June 27, 2011 12:37
maven-glassfish-plugin configuration
<plugin>
<groupId>org.glassfish.maven.plugin</groupId>
<artifactId>maven-glassfish-plugin</artifactId>
<version>2.1</version>
<configuration>
<glassfishDirectory>${glassfish.home}</glassfishDirectory>
<user>${domain.username}</user>
<passwordFile>${glassfish.home}/domains/${project.build.finalName}/master-password</passwordFile>
<autoCreate>true</autoCreate>
<debug>true</debug>
@behrangsa
behrangsa / login-form.js
Created July 3, 2011 09:11
Fixed installAmination function
function installAnimation(inputElem, marginTopEnd, animationLength) {
$(inputElem).bind('input', function() {
var label = $(this).prev("label");
var labelMarginTop = label.css('margin-top');
label.stop();
if ($(this).val().length > 0) {
animateMarginTop(label, marginTopEnd, animationLength);
} else if ($(this).val().length == 0) {
animateMarginTop(label, "0px", animationLength);
}
@behrangsa
behrangsa / poms.xml
Created September 25, 2011 13:02
GWT Maven multi module
<!-- Parent POM: -->
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>foo</groupId>
<artifactId>parent</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>pom</packaging>
@behrangsa
behrangsa / poms.xml
Created September 26, 2011 10:14
Dependency management problem
<!-- Parent POM -->
<!-- Spring -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<version>${spring.version}</version>
<scope>compile</scope>
</dependency>
<!-- child POM -->
$ git checkout develop
$ git merge --no-ff myfeature
$ git branch -d myfeature
$ git push origin develop
markdown = Redcarpet::Markdown.new(Redcarpet::Render::HTML)
code = "```ruby
1 + 1
```"
markdown.render(code)
# produces
# <p><code>ruby\n1 + 1\n</code></p>\n
# rather than
# <p><code>1 + 1\n</code></p>\n
@behrangsa
behrangsa / user_controller.rb
Created February 5, 2012 10:34
SO Question
class UsersController < ApplicationController
before_filter :authenticate, :only => [:index, :edit, :update]
before_filter :correct_user, :only => [:edit, :update]
before_filter :admin_user, :only => :destroy
def index
@title = "All users"
@users = User.paginate(:page => params[:page])
end
@behrangsa
behrangsa / gist:2181303
Created March 24, 2012 11:26
Installing Ruby 1.8.7 via RVM in OS X 10.7 Lion + XCode 4.2+
  • Install MacPorts
  • Install apple-gcc-42 via MacPorts: sudo port install apple-gcc-42
  • Install RVM (I had some issues with stable, so I went with 1.10.2, but stable might work for you):
    • bash -s -- --version 1.10.2 < <(curl -s https://raw.github.com/wayneeseguin/rvm/master/binscripts/rvm-installer )
    • bash -s stable < <(curl -s https://raw.github.com/wayneeseguin/rvm/master/binscripts/rvm-installer )
  • Install Ruby 1.8.7 using apple-gcc-42: CC=/opt/local/bin/gcc-apple-4.2 rvm install 1.8.7
  • Enjoy!
@behrangsa
behrangsa / gist:2249371
Created March 30, 2012 08:14 — forked from dx7/gist:1333785
Installing ruby-debug with ruby-1.9.3-p0
# Install with:
# bash < <(curl -L https://raw.github.com/gist/2249371)
#
# Reference: http://blog.wyeworks.com/2011/11/1/ruby-1-9-3-and-ruby-debug
echo "Installing ruby-debug with ruby-1.9.3-p125 ..."
curl -OL http://rubyforge.org/frs/download.php/75414/linecache19-0.5.13.gem
curl -OL http://rubyforge.org/frs/download.php/75415/ruby-debug-base19-0.11.26.gem
@behrangsa
behrangsa / hack.sh
Created March 31, 2012 14:48 — forked from erikh/hack.sh
OSX For Hackers
#!/usr/bin/env sh
##
# This is script with usefull tips taken from:
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
#
# install it:
# curl -sL https://raw.github.com/gist/2108403/hack.sh | sh
#