Skip to content

Instantly share code, notes, and snippets.

View rscarvalho's full-sized avatar

Rodolfo Carvalho rscarvalho

View GitHub Profile
json.professional_histories @histories do |professional_history|
json.id professional_history.id
json.city professional_history.city.name
end
function! g:UltiSnips_Complete()
call UltiSnips#ExpandSnippet()
if g:ulti_expand_res == 0
if pumvisible()
return "\<C-n>"
else
call UltiSnips#JumpForwards()
if g:ulti_jump_forwards_res == 0
return "\<TAB>"
endif
PRY_CALLS=$(git diff --cached | grep -nw 'binding.pry')
if [ -z "$PRY_CALLS" ]; then
echo "You've left a binding.pry in one or more files:"
echo $PRY_CALLS
exit 1
fi
upstream rails_app_server {
# Coloque a porta que o thin vai rodar - nao coloque ele pra rodar na porta 80!
server 127.0.0.1:3000;
}
server {
listen 80;
server_name seudominio;
keepalive_timeout 5;
NSString *text = [publicacao.texto
stringByTrimmingCharactersInSet:[NSCharacterSet
whitespaceAndNewlineCharacterSet]];
self.textLabel.text = [text substringToIndex:MIN(text.length, 80)];
if (text.length > 80) {
self.textLabel.text = [self.textLabel.text stringByAppendingString:@"..."];
}
from pyquery import PyQuery
hora_brasilia = PyQuery(url='http://pcdsh01.on.br/HoraLegalBrasileira.asp')("td[bgcolor='#FFFF00']:first").text()
print "Horario de Brasilia", hora_brasilia
public MyEnum getEnumObject() {
final List<String> enumStrings = new ArrayList<>();
enumStrings.add(null);
enumStrings.add("A");
enumStrings.add("C");
enumStrings.add("B");
enumStrings.add("D");
Optional<MyEnum> e = enumStrings.stream()
.filter(s -> s != null)
@rscarvalho
rscarvalho / cmd.applescript
Created June 10, 2016 16:11
Afred - run shell command in current open terminal window
on write_to_file(this_data, target_file, append_data)
try
set the target_file to the target_file as string
set the open_target_file to open for access file target_file with write permission
if append_data is false then set eof of the open_target_file to 0
write this_data to the open_target_file starting at eof
close access the open_target_file
return true
on error
try
import React from 'react';
import ReactDOM from 'react-dom';
import Redux from 'redux';
import { createStore } from 'redux';
import { connect, Provider } from 'react-redux';
class MyComponent extends React.Component {
render() {
const { active, toggle } = this.props;
@rscarvalho
rscarvalho / App.jsx
Last active March 14, 2017 11:21
KeyUp handler using RxJS + React
const store = createStore();
ReactDOM.mount(
<Provider store={store}>
<WindowWrapper>
<GameCanvas />
</WindowWrapper>
</Provider>
)