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
module EchoClient | |
ADDRESS = 'localhost' | |
PORT = 8081 | |
class << self | |
def get(data) | |
result = "" | |
EventMachine::run do |
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
socket = TCPSocket.new('localhost', 8081) | |
socket.write(configs) | |
stream = "" | |
while data = socket.read(1024) | |
stream << data | |
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
@@accents = ["(a|á|à|â|ã)","(e|é|è|ê)","(i|í|ì)","(o|ó|ò|ô|õ)","(u|ú|ù)","(c|ç)"] | |
def accent_insensitive | |
str = String.new(self) | |
@@accents.each {|exp| str.gsub! Regexp.new(exp), exp} | |
str | |
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
public static List<Category> getList() { | |
Gson gson = new Gson(); | |
String json_string = API.getJSON("http://u8r.herokuapp.com/categories.json"); | |
return Arrays.asList(gson.fromJson(json_string, Category[].class)); | |
} | |
public static List<Category> getSubList(Integer category_id) { | |
Gson gson = new Gson(); | |
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
class SomeTest extends PHPUnit_Framework_TestCase | |
{ | |
public function methodRunShouldExist() | |
{ | |
$example = new ExampleClass(); | |
$this->assertTrue(method_exists($example, 'run')); | |
} | |
} | |
class ExampleClass |
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
print $this->Html->script('jquery_file_upload/vendor/jquery.ui.widget'); | |
print $this->Html->script('jquery_file_upload/jquery.iframe-transport'); | |
print $this->Html->script('jquery_file_upload/jquery.fileupload'); | |
$('input[type="file"]').fileupload({ | |
acceptFileTypes: /(\.|\/)(gif|jpe?g|png)$/i, | |
start: function() { | |
$('#'+$(this).attr('id')+'_loading').show(); | |
}, | |
done: function (e, data) { |
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
1) gedit ~/.config/user-dirs.dirs | |
remove the list you do not want. however, once you login again, it will reset, so --> | |
2) echo "enabled=false" > ~/.config/user-dirs.conf |
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
var fs = require('fs'); | |
fs.readdir(__dirname, function(err, files) { | |
sayRoutes(files); | |
}); | |
function sayRoutes (files) { | |
files.forEach(function (file) { | |
read(file, function (routes) { | |
if (routes.length > 0) { |
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
##################### ElasticSearch Configuration Example ##################### | |
# This file contains an overview of various configuration settings, | |
# targeted at operations staff. Application developers should | |
# consult the guide at <http://elasticsearch.org/guide>. | |
# | |
# The installation procedure is covered at | |
# <http://elasticsearch.org/guide/reference/setup/installation.html>. | |
# | |
# ElasticSearch comes with reasonable defaults for most settings, |
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
# Replace your PS1, inside ~/.bashrc for this: | |
# source ~/.bashrc_git | |
# PS1='\w\[\033[0;32m\]$(parse_git_branch_or_tag)\[\033[00m\]: ' | |
parse_git_branch () { | |
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/' | |
} | |
parse_git_tag () { | |
git describe --tags 2> /dev/null |