This file contains hidden or 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
| /*! | |
| * shapes | |
| */ | |
| #square { | |
| width: 100px; | |
| height: 100px; | |
| background: red; | |
| } | |
| #rectangle { |
This file contains hidden or 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 apt-get update | |
| sudo apt-get install build-essential module-assistant linux-headers-`uname -r` | |
| sudo m-a prepare | |
| sudo sh VBoxLinuxAdditions.run |
This file contains hidden or 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
| (function($){ | |
| var o = $( {} ); | |
| $.each({ | |
| on: 'subscribe', | |
| trigger: 'publish', | |
| off: 'unsubscribe' | |
| }, function( key, api) { | |
| $[api] = function() { | |
| o[key].apply( o, arguments ); |
This file contains hidden or 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
| $.fn.random = function() { | |
| var rand = Math.floor( Math.random() * this.length + 1 ); | |
| return this[rand]; | |
| }; |
This file contains hidden or 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
| # slug to capitalized words i.e for_whom_the_bell_tolls --> For Whom The Bell Tools and the-old-man-and-the-sea --> The Old Man And The Sea | |
| # | |
| sed -e 's/^./\U&/' -e 's/_./\U&/g' -e 's/_/ /g' slugs.txt | |
| sed -e 's/^./\U&/' -e 's/-./\U&/g' -e 's/-/ /g' slugs.txt |
This file contains hidden or 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
| asfbin-bin -i myvideo.wmv -start 00:00 -stop 05:23 -o my.edited.video.wmv | |
| asfbin-bin -i myvideo.wmv -start 02:13 -stop 04:01 -start 08:05 -stop 09:51 -o my.edited.video.wmv | |
| mp3gain -r *.mp3 |
This file contains hidden or 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
| //http://www.slf4j.org/docs.html | |
| //http://www.slf4j.org/faq.html#string_or_object | |
| final Logger logger = LoggerFactory.getLogger(MyClass.class); | |
| // use message format to add to log. | |
| logger.debug("Set {1,2} differs from {}", "3"); = "Set {1,2} differs from 3" | |
| logger.debug("Set {1,2} differs from {{}}", "3"); = "Set {1,2} differs from {3}". | |
| logger.debug("{}", complexObject); = invokes toString on complexObject |
This file contains hidden or 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
| /** | |
| use joda time instead of java Date. | |
| http://joda-time.sourceforge.net/ | |
| http://www.ibm.com/developerworks/java/library/j-jodatime.html | |
| All methods should pass a DateTime object instead of Date. Spring will detect if joda is present on the classpath | |
| and handle all converstions to DateTime automagically. | |
| If you do have to pass a date formated string via url, query param, method signature etc, it should always be: | |
| yyyy-MM-dd |
This file contains hidden or 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
| /** | |
| * Returns the movie title's next airing date. | |
| * | |
| * @return the airing date | |
| */ | |
| @XmlJavaTypeAdapter(XmlAiringDateAdapter.class) | |
| public Date getDate() { | |
| return date; | |
| } | |
| // we can custom format the output by implementing our own adapter in spring |
This file contains hidden or 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
| <!-- VIEW RESOLVERS IN NESTED ORDER | |
| Looks first at file type then mime type | |
| When the extension is | |
| - '.xml', it will delegate to JAXB Marshalling view | |
| - '.rss', it will delegate to the InternalResourceViewResolver's JstlView | |
| - '.html', it will delegate to the InternalResourceViewResolver's JstlView | |
| - '.json', it will delegate to the MappingJacksonJsonView | |
| Second, delegates to BeanNameViewResolve to find a bean id matching the returned View | |
| Third, delegates to InternalResourceViewResolver and tries to find a matching jsp | |
| --> |
OlderNewer