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
| # include from an initializer | |
| module HstoreAccessor | |
| def self.included(base) | |
| base.extend(ClassMethods) | |
| end | |
| module ClassMethods | |
| def hstore_accessor(hstore_attribute, *keys) | |
| Array(keys).flatten.each do |key| |
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
| @mixin image-link($width, $height, $src) { | |
| display: block; | |
| width: $width; | |
| height: $height; | |
| background-image: url($src); | |
| // if using Rails 3.x Asset Pipeline you can use the following instead | |
| // background-image: image-url($src); | |
| background-repeat: no-repeat; | |
| text-indent: 100%; | |
| white-space: nowrap; |
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
| <% if request.xhr? %> | |
| <script> | |
| if (!document.getElementsByTagName("body")[0]){ location.reload(true); } | |
| </script> | |
| <% end %> |
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
| <!-- put this inside your view that is not using a layout --> | |
| <% if request.xhr? %> | |
| <script> | |
| if (!document.getElementsByTagName("body")[0]){ location.reload(true); } | |
| </script> | |
| <% end %> |
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
| cd ~ | |
| sudo apt-get update | |
| sudo apt-get install openjdk-7-jre -y | |
| wget https://github.com/downloads/elasticsearch/elasticsearch/elasticsearch-0.19.9.tar.gz -O elasticsearch.tar.gz | |
| tar -xf elasticsearch.tar.gz | |
| rm elasticsearch.tar.gz | |
| sudo mv elasticsearch-* elasticsearch | |
| sudo mv elasticsearch /usr/local/share |
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
| check process redis | |
| start program = "/usr/bin/redis-server /etc/redis/redis.conf" | |
| stop program = "/usr/bin/redis-cli -p 6379 shutdown" | |
| with pidfile /var/run/redis.pid |
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 shuffle(array:Array):Array { | |
| var newArray:Array = new Array(); | |
| while(array.length > 0){ | |
| var obj:Array = array.splice(Math.floor(Math.random()*array.length), 1); | |
| newArray.push(obj[0]); | |
| } | |
| return newArray; | |
| } |
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
| 400 | |
| 403 | |
| 404 | |
| 418 | |
| 422 | |
| 500 | |
| 502 | |
| about | |
| acces | |
| account |
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
| # remove apache | |
| sudo apt-get remove --purge $(dpkg -l apache* | grep ii | awk '{print $2}') | |
| sudo apt-get autoremove | |
| sudo apt-get remove apache2* |
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
| git branch --merged | grep -v "\*" | xargs -n 1 git branch -d |