Skip to content

Instantly share code, notes, and snippets.

View lucasmarqs's full-sized avatar

Lucas Marques lucasmarqs

  • Sao Paulo, Brazil
View GitHub Profile
@lucasmarqs
lucasmarqs / RSpecHtmlMatcher.rb
Last active January 11, 2016 21:07
Rspec :have_tag matcher
require 'rspec/expectations'
RSpec::Matchers.define :have_tag do |html_tag|
match do |html_string|
@doc = Nokogiri::HTML.fragment(html_string)
@html_tag = html_tag
if @class_names.nil? && @content.nil?
have_html_tag?(html_tag)
elsif @class_names && @content.nil?
@lucasmarqs
lucasmarqs / sorting_int_vector_by_desc.c
Created March 3, 2016 01:16
Enter a int vector and order it by desc
#include <stdio.h>
#define MAX 100
int defineMaxIndex();
void receiveNumbers(int nums[], int maxIndex);
void descSort(int nums[], int maxIndex);
void printVector(int nums[], int maxIndex);
int main()
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
struct Node {
float value;
struct Node *next;
};
int isNumber(char input[]);
@lucasmarqs
lucasmarqs / tools_controller.rb
Last active May 23, 2016 00:54
Minimum CRUD on Rails
class Admin::ToolsController < AdminController
expose :tools, ancestor: :company
expose :tool, attributes: :tool_params
def create
if tool.save
set_flash_success_and_redirect_to admin_tools_path
else
render :new
end
@lucasmarqs
lucasmarqs / Preferences.sublime-settings
Last active May 10, 2017 12:55
Sublime preferences
{
"binary_file_patterns":
[
"*.jpg",
"*.jpeg",
"*.png",
"*.gif",
"*.ttf",
"*.tga",
"*.dds",
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
void bubbleSort(int vet[], int len);
int main() {
srand(time(NULL));
int vet[10];
@lucasmarqs
lucasmarqs / fib_hash.rb
Created April 1, 2017 22:58
Recursive Fibonacci with Ruby Hash
fib = Hash.new do |hash, key|
if key < 2
hash[key] = key
else
hash[key] = hash[key-2] + hash[key-1]
end
end
#=> {}
fib[3]
@lucasmarqs
lucasmarqs / .gitconfig
Last active December 1, 2020 22:05
My options for ~/.gitconfig
[user]
name = My name
email = my_github_email@example.com
[alias]
a = add
ap = add -p
can = commit -S --amend --no-edit
cm = commit -S -m
co = checkout
@lucasmarqs
lucasmarqs / tmux.conf
Created April 13, 2018 18:27
tmux.conf
#-------------------------------------------------------------------------------
# POWER ALL THE LINE!
# run-shell "powerline-daemon -q"
# source "$HOME/workspace/powerline/powerline/bindings/tmux/powerline.conf"
# edit configuration
bind e new-window -n '~/.tmux.conf' "sh -c '\${EDITOR} ~/.tmux.conf && tmux source ~/.tmux.conf && tmux display \"~/.tmux.conf sourced\"'"
#-------------------------------------------------------------------------------
# List of plugins
@lucasmarqs
lucasmarqs / tmux.conf
Created April 13, 2018 18:27
tmux.conf
#-------------------------------------------------------------------------------
# POWER ALL THE LINE!
# run-shell "powerline-daemon -q"
# source "$HOME/workspace/powerline/powerline/bindings/tmux/powerline.conf"
# edit configuration
bind e new-window -n '~/.tmux.conf' "sh -c '\${EDITOR} ~/.tmux.conf && tmux source ~/.tmux.conf && tmux display \"~/.tmux.conf sourced\"'"
#-------------------------------------------------------------------------------
# List of plugins