Skip to content

Instantly share code, notes, and snippets.

View behrangsa's full-sized avatar
💾

Behrang Saeedzadeh behrangsa

💾
View GitHub Profile
@behrangsa
behrangsa / IDEA Formatting.js
Created February 8, 2014 09:14
How to configure IDEA to format chained method calls better?
// IDEA formats like this:
Foo.bar(params).then(function () {
}).catch(function () {
});
// I want it to be like this:
@behrangsa
behrangsa / gist:9085005
Created February 19, 2014 02:30
Typo in JCR spec

Where: [javax/jcr/Node.html#setProperty(java.lang.String, javax.jcr.Value)](http://www.day.com/maven/javax.jcr/javadocs/jcr-2.0/javax/jcr/Node.html#setProperty(java.lang.String, javax.jcr.Value))

What: "by the" is repeated twice:

If the property does not yet exist, it is created and its property type determined by the by the node type of this node. If, based on the name and value passed, there is more than one property definition that applies, the repository chooses one definition according to some implementation-specific criteria. Once a property with name P has been created, the behavior of a subsequent setProperty(P,V) may differ across implementations. Some repositories may allow P to be dynamically re-bound to a different property definition (based for example, on the new value being of a different type than the original value) while other repositories may not allow such dynamic re-binding.

@behrangsa
behrangsa / constraint-violation.json
Created February 22, 2014 13:24
ConstraintViolation JSON generated by XStream
{
"set":[
{
"org.hibernate.validator.internal.engine.ConstraintViolationImpl":[
{
"interpolatedMessage":"may not be null",
"rootBean":{
"@class":"org.behrang.MyBean"
},
"propertyPath":{
#!/bin/bash
#
# This script creates an app which launches Google Chrome with a new profile
# and allows for running multiple instances of Chrome simultaneously.
#
# Based on: http://blog.duoconsulting.com/2011/03/13/multiple-profiles-in-google-chrome-for-os-x/
set -e
if [ $# == 0 ]; then
@behrangsa
behrangsa / rvm_trace.sh
Created April 20, 2014 14:00
RVM Trace
$ ( export rvm_trace flag=1; export PS4="+ \$(__rvm_date \"+%s.%N\") \${BASH_SOURCE##\${rvm_path:-}/} : \${FUNCNAME[0]:+\${FUNCNAME[0]}()} \${LINENO} > "; set -x; source "$HOME/.rvm/scripts/rvm" 2>&1; )
-bash: __rvm_date: command not found
+ : 1 > source /Users/behrangsa/.rvm/scripts/rvm
-bash: __rvm_date: command not found
++ Users/behrangsa/.rvm/scripts/rvm : source() 10 > test -n '4.3.8(1)-release' -o -n ''
-bash: __rvm_date: command not found
++ Users/behrangsa/.rvm/scripts/rvm : source() 12 > case "`uname`" in
-bash: __rvm_date: command not found
+++ Users/behrangsa/.rvm/scripts/rvm : source() 12 > uname
-bash: __rvm_date: command not found
@behrangsa
behrangsa / rvm_trace.sh
Created April 20, 2014 14:15
RVM Trace with precision timing
Last login: Mon Apr 21 00:14:34 on ttys005
$ ( export rvm_trace flag=1; export PS4="+ \$(date \"+%s.%N\" 2>/dev/null) \${BASH_SOURCE##\${rvm_path:-}/} : \${FUNCNAME[0]:+\${FUNCNAME[0]}()} \${LINENO} > "; set -x; source "$HOME/.rvm/scripts/rvm" 2>&1; )
+ 1398003300.744033000 : 1 > source /Users/behrangsa/.rvm/scripts/rvm
++ 1398003300.750901000 Users/behrangsa/.rvm/scripts/rvm : source() 10 > test -n '4.3.8(1)-release' -o -n ''
++ 1398003300.756899000 Users/behrangsa/.rvm/scripts/rvm : source() 12 > case "`uname`" in
+++ 1398003300.763327000 Users/behrangsa/.rvm/scripts/rvm : source() 12 > uname
+++ 1398003300.774796000 Users/behrangsa/.rvm/scripts/rvm : source() 14 > ps -p 20007 -o comm=
++ 1398003300.783647000 Users/behrangsa/.rvm/scripts/rvm : source() 14 > __shell_name=-bash
++ 1398003300.789747000 Users/behrangsa/.rvm/scripts/rvm : source() 16 > case "$__shell_name" in
++ 1398003300.796198000 Users/behrangsa/.rvm/scripts/rvm : source() 19 > unset __shell_name
@behrangsa
behrangsa / pom.xml
Created June 4, 2014 02:17
Content Package Plugin
<plugin>
<groupId>org.apache.sling</groupId>
<artifactId>maven-sling-plugin</artifactId>
<version>2.1.0</version>
<configuration>
<user>${crx.username}</user>
<password>${crx.password}</password>
</configuration>
</plugin>
<plugin>
@behrangsa
behrangsa / debug.log
Created July 5, 2014 02:05
Buggy progress bar
$ vagrant box add --debug ubuntu/trusty32
INFO global: Vagrant version: 1.6.3
INFO global: Ruby version: 2.0.0
INFO global: RubyGems version: 2.0.14
INFO global: VAGRANT_EXECUTABLE="/Applications/Vagrant/bin/../embedded/gems/gems/vagrant-1.6.3/bin/vagrant"
INFO global: VAGRANT_INSTALLER_EMBEDDED_DIR="/Applications/Vagrant/bin/../embedded"
INFO global: VAGRANT_INSTALLER_VERSION="2"
INFO global: VAGRANT_DETECTED_OS="Darwin"
INFO global: VAGRANT_INSTALLER_ENV="1"
INFO global: VAGRANT_INTERNAL_BUNDLERIZED="1"
@behrangsa
behrangsa / TablePanel.java
Last active August 29, 2015 14:05
TablePanel (retrieved via web.archive.org)
import javax.swing.*;
import javax.swing.event.TableColumnModelListener;
import javax.swing.event.TableColumnModelEvent;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ListSelectionEvent;
import javax.swing.table.JTableHeader;
import javax.swing.table.TableColumn;
import javax.swing.table.DefaultTableColumnModel;
import java.awt.*;
@behrangsa
behrangsa / gitbr.sh
Created August 29, 2014 01:29
Git Branches
for proj in ~/Projects/* ; do
if [[ -d "$proj" && -d "$proj/.git" ]]; then
echo -n "$proj: "
cd $proj && git branch | sed -n '/\* /s///p'
fi
done