Skip to content

Instantly share code, notes, and snippets.

View lmansur's full-sized avatar

Lucas Mansur lmansur

View GitHub Profile
@lmansur
lmansur / .rb
Created October 29, 2016 08:24
require 'rails_helper'
describe CsvHandler::TotalRevenue do
describe '#total_revenue' do
before do
@import = CsvHandler::ImportData.new('public', 'purchases.csv')
@import.import
@revenue = CsvHandler::TotalRevenue.new('public', 'purchases.csv')
end
@lmansur
lmansur / .rb
Created November 16, 2016 04:33
### author.rb
class Author < ApplicationRecord
has_many :books
validates :name, presence: true
end
### authors_controllers.rb
@lmansur
lmansur / .sh
Created November 23, 2016 17:07
15:06:46 search.1 | starts elasticsearch
15:06:46 search.1 |
15:06:46 search.1 | Option Description
15:06:46 search.1 | ------ -----------
15:06:46 search.1 | -E <KeyValuePair> Configure a setting
15:06:46 search.1 | -V, --version Prints elasticsearch version information and exits
15:06:46 search.1 | -d, --daemonize Starts Elasticsearch in the background
15:06:46 search.1 | -h, --help show help
15:06:46 search.1 | -p, --pidfile <Path> Creates a pid file in the specified path on start
15:06:46 search.1 | -q, --quiet Turns off standard ouput/error streams logging in console
15:06:46 search.1 | starts elasticsearch
15:06:46 search.1 |
15:06:46 search.1 | Option Description
15:06:46 search.1 | ------ -----------
15:06:46 search.1 | -E <KeyValuePair> Configure a setting
15:06:46 search.1 | -V, --version Prints elasticsearch version information and exits
15:06:46 search.1 | -d, --daemonize Starts Elasticsearch in the background
15:06:46 search.1 | -h, --help show help
15:06:46 search.1 | -p, --pidfile <Path> Creates a pid file in the specified path on start
15:06:46 search.1 | -q, --quiet Turns off standard ouput/error streams logging in console
@lmansur
lmansur / .rb
Created December 1, 2016 00:10
if [endereco.rua, endereco.cidade, endereco.cep].any?(&:blank?)
#do something
end
@lmansur
lmansur / hz.cfg
Last active April 6, 2017 21:10 — forked from eduardohertz/hz.cfg
CS:GO configuration file
unbindall
bind "CapsLock" "use weapon_smokegrenade"
bind "0" "slot10"
bind "1" "slot1"
bind "2" "slot2"
bind "3" "slot3"
bind "4" "slot4"
bind "5" "slot5"
bind "6" "slot6"
bind "7" "slot7"
@lmansur
lmansur / .rb
Created February 8, 2018 00:16
resource = ARGV[0]
directory_pattern = "*#{resource}*/*_spec.rb"
single_spec_pattern = "*/*#{resource}*_spec.rb"
resource_pattern = "**/{#{directory_pattern},#{single_spec_pattern}}"
Dir.chdir("spec")
spec_files = Dir.glob(resource_pattern).sort.uniq.join(" ")
system("rspec #{spec_files}")
/**
* Sample React Native App
* https://github.com/facebook/react-native
*
* @format
* @flow
*/
import React, {PureComponent} from 'react';
import {
module.exports = async function(data) {
if(data.type == 'remote-play') {
// The play button was pressed, we can forward this command to the player using
TrackPlayer.play();
} else if(data.type == 'remote-pause') {
TrackPlayer.pause();
} else if(data.type == 'remote-stop') {
TrackPlayer.stop();
}
};
#!/usr/bin/bash
function _open() {
spotify_uri=$1
is_spotify_running=$(pgrep spotify)
if [[ $is_spotify_running ]]; then
dbus-send --type=method_call --dest=org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.OpenUri string:$spotify_uri
else
spotify --uri=$spotify_uri