Skip to content

Instantly share code, notes, and snippets.

@cv
cv / bad.go
Created Feb 12, 2020
shorten scope of intermediate variables
View bad.go
func (a *b) C(ctx context.Context) (*d, error) {
thingWithLongName, err := a.someService.Get(ctx, servicepkg.GetInput{
// …
})
if err == servicepkg.NotFound {
return &d{}, nil
}
if err != nil {
return nil, err
}
View pr-queue.rb
#!/usr/bin/env ruby
require "bundler/inline"
ORG=(ARGV.length == 1 && ARGV[0]) or raise "Usage: pr-queue.rb <org-name>"
gemfile do
source "https://rubygems.org"
gem "octokit"
gem "pry"
View keybase.md

Keybase proof

I hereby claim:

  • I am cv on github.
  • I am cvillela (https://keybase.io/cvillela) on keybase.
  • I have a public key ASAr-oB0XnKMqnPRmVemZAF9M8TDyAvRi7qKFphjLm4whgo

To claim this, I am signing this object:

View .spacemacs
;; -*- mode: emacs-lisp -*-
;; This file is loaded by Spacemacs at startup.
;; It must be stored in your home directory.
(defun dotspacemacs/layers ()
"Configuration Layers declaration .
You should not put any user code in this function besides modifying the variable
values . "
(setq-default
;; Base distribution to use. This is a layer contained in the directory
@cv
cv / robot.js
Created Dec 5, 2012 — forked from fabiopimentel/robot.js
[CAELUM TEAM]Megatron
View robot.js
//FightCode can only understand your robot
//if its class is called Robot
var Robot = function(robot) {
};
Robot.prototype.onIdle = function(ev) {
var robot = ev.robot;
robot.clone();
View gist:4016135
git config --global github.password 'security find-internet-password -wgs github.com # 2>&1 >/dev/null find-internet-password -wgs github.com'
View gist:3148416
++ pwd
+ PWD=/var/lib/go-agent/pipelines/profiles/tmp/rpmbuild/BUILD/profiles
+ env -i GEM_HOME=/var/lib/go-agent/pipelines/profiles/tmp/rpmbuild/BUILD/profiles/vendor/bundle/ruby/1.9.1 GEM_PATH=/var/lib/go-agent/pipelines/profiles/tmp/rpmbuild/BUILD/profiles/vendor/bundle/ruby/1.9.1 gem install bundler --no-rdoc --no-ri
ERROR: Could not find a valid gem 'bundler' (>= 0) in any repository
ERROR: Possible alternatives: bundler
error: Bad exit status from /var/tmp/rpm-tmp.23649 (%build)
Bad exit status from /var/tmp/rpm-tmp.23649 (%build)
View headless-jasmine
tw@hernan-cortes:~$ [master*] time rake jasmine:headless
....................................
PASS: 36 tests, 0 failures, 0.175 secs.
real 0m4.303s
user 0m2.660s
sys 0m0.900s
View gist:1169573
require 'rubygems'
require 'rspec'
module EventLogging
def self.included(base)
base.extend ClassMethods
end
module ClassMethods