Skip to content

Instantly share code, notes, and snippets.

😎

Adan Alvarado aalvarado

😎
Block or report user

Report or block aalvarado

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@aalvarado
aalvarado / calls.rb
Last active Mar 4, 2019
Faraday calls with cookies against Sinatra / Rack
View calls.rb
require 'faraday-cookie_jar'
#all one liners because it's easier for irb/pry
conn = Faraday.new(:url => 'http://localhost:3535'){ |f| f.request :url_encoded; f.response :logger; f.adapter Faraday.default_adapter; f.use :cookie_jar }
res = conn.get('/route')
cookie2 = res.headers['set-cookie']
@aalvarado
aalvarado / main.rs
Created Feb 23, 2019
Naive circular queue in Rust
View main.rs
use std::fmt;
#[derive(Debug)]
struct CircularQueue<T> {
max: usize,
list: Vec<T>,
}
impl <T> CircularQueue<T> where T: std::string::ToString {
pub fn new(max: usize) -> CircularQueue<T> {
View .ctags
--exclude=*.json
--exclude=*.lock
--exclude=*.yaml
--exclude=.bundle
--exclude=Gemfile
--exclude=Gemfile.lock
--exclude=*.git*
--exclude=*.pyc
View esc-caps-toggle.json
{
"title": "Escape enhancements",
"rules": [
{
"description": "Escape toggles capslock if enabled",
"manipulators": [
{
"type": "basic",
"from": {
"key_code": "escape",
@aalvarado
aalvarado / my.cnf
Last active Dec 20, 2015
Faster mysql restores
View my.cnf
# /opt/local/etc/mysql5/my.cnf
innodb_buffer_pool_size=192M
innodb_additional_mem_pool_size=96M
innodb_flush_log_at_trx_commit=2
innodb_log_buffer_size=64M
innodb_file_per_table
key_buffer = 32M
max_allowed_packet = 32M
View crap.cpp
#include <iostream>
class Crap {
private:
int times;
public:
Crap() {
times = 0;
}
View positions_controller.rb
before_filter :find_position, only: [:show, :destroy, :edit]
def destroy
if @position.destroy
flash[:success] = t('labels.success')
else
flash[:error] = t('labels.error')
end
redirect_to positions_path
end
@aalvarado
aalvarado / thoughts.md
Last active Dec 18, 2015
My thoughts on young life and becoming an adult.
View thoughts.md

License

Attribution-NonCommercial-ShareAlike 3.0 Unported http://creativecommons.org/licenses/by-nc-sa/3.0/deed.en_US

Notice

I do not claim expertise on any of the subjects I list here. It is through my understanding and experience that I feel entitled to write about them. It is my intent to write a short guide for my younger siblings, in hopes that it will give them direction in becoming a happy human being.

Assumptions

  • You have basic motor and cognitive skills
  • You've understood the purpose of the introduction above
@aalvarado
aalvarado / ctags.txt
Created Apr 1, 2013
Exhuberant ctags with javascript filtering and appending to `tags` file.
View ctags.txt
ctags -aR --languages=-javascript app
You can’t perform that action at this time.