Skip to content

Instantly share code, notes, and snippets.

Avatar
😎

Adan Alvarado aalvarado

😎
View GitHub Profile
View keybase.md

Keybase proof

I hereby claim:

  • I am aalvarado on github.
  • I am adantj (https://keybase.io/adantj) on keybase.
  • I have a public key ASDVzoFdsJZ2XrWVJCP6piQo_J9C7xCAufnOoltiXhkpawo

To claim this, I am signing this object:

@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",
View rust1.rs
struct Person;
impl Person {
fn hello(&self) -> &'static str {
return "hello";
}
}
fn main() {
println!("Hello, world!");
let p = Person;
@aalvarado
aalvarado / pg_change_db_owner.sh
Created Sep 29, 2015 — forked from jirutka/pg_change_db_owner.sh
Some convenient scripts to manage ownerships and privileges in PostgreSQL.
View pg_change_db_owner.sh
#!/bin/bash
#
# The MIT License
#
# Copyright 2014 Jakub Jirutka <jakub@jirutka.cz>.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
@aalvarado
aalvarado / fizzbuzz.rb
Created Jun 1, 2015
FizzBuzz Ruby without any integer modulus or division
View fizzbuzz.rb
limit = 100
fizz = ['']*2 << 'fizz'
buzz = ['']*4 << 'buzz'
(1..limit).to_a.zip(fizz.cycle(limit).to_a.zip(buzz.cycle(limit).to_a)).each{ |n| puts n.join(' ') }
View presentation
* Acerca de Git
- ¿Por que es necesario?
- Otras opciones en control de versiones
- Distribuidos y centralizados
* Recursos
- Pro Git book. http://git-scm.com/book
- StackOverflow
- Internet
@aalvarado
aalvarado / solution.rb
Created Mar 10, 2015
PermMissingElem
View solution.rb
def solution(a)
((( a.size + 2 ) * ( a.size + 1 )) / 2) - ( a.reduce(&:+) || 0 )
end