Skip to content

Instantly share code, notes, and snippets.

View klebershimabuku's full-sized avatar

Kleber Shimabuku klebershimabuku

View GitHub Profile
@TunkShif
TunkShif / init.lua
Last active April 21, 2024 21:41
neovim config for elixir development
local execute = vim.api.nvim_command
local fn = vim.fn
local fmt = string.format
local pack_path = fn.stdpath("data") .. "/site/pack"
-- ensure a given plugin from github.com/<user>/<repo> is cloned in the pack/packer/start directory
local function ensure (user, repo)
local install_path = fmt("%s/packer/start/%s", pack_path, repo)
if fn.empty(fn.glob(install_path)) > 0 then
@remarkablemark
remarkablemark / Dockerfile
Last active May 17, 2024 02:03
Install node and npm with nvm using Docker.
# set the base image to Debian
# https://hub.docker.com/_/debian/
FROM debian:latest
# replace shell with bash so we can source files
RUN rm /bin/sh && ln -s /bin/bash /bin/sh
# update the repository sources list
# and install dependencies
RUN apt-get update \
@sam452
sam452 / rake output.txt
Created May 19, 2014 15:21
Why am I getting rails 4 migrate super: no superclass method `version' activerecord errors when I rake db:migrate?
Migration successful on Windows. Commit and pushed to github. Pulled on Mac which has successfully run this app before. But migration fails on the Mac.
All other migrations on other Rails apps on the Mac fail with the same error.
Stepped down to Ruby 1.9.3 but failure repeats.
The only instance of 'version' that shows up in Sublime text of the app that is not commented out is in Schema.rb. The usage matches previous successful commits.
@visenger
visenger / install_scala_sbt.sh
Last active January 31, 2023 19:10
Scala and sbt installation on ubuntu 12.04
#!/bin/sh
# one way (older scala version will be installed)
# sudo apt-get install scala
#2nd way
sudo apt-get remove scala-library scala
wget http://www.scala-lang.org/files/archive/scala-2.11.4.deb
sudo dpkg -i scala-2.11.4.deb
sudo apt-get update
@brettfishman
brettfishman / gist:3868277
Created October 10, 2012 20:39
Testing HTTP caching using RSpec and CanCan
# Given a controller that looks like this
class ModelsController < ApplicationController
load_and_authorize_resource #CanCan
def show
if stale? @model
respond_to do |format|
format.json do
@model
end
@mikhailov
mikhailov / 0. nginx_setup.sh
Last active April 2, 2024 14:57
NGINX+SPDY with Unicorn. True Zero-Downtime unless migrations. Best practices.
# Nginx+Unicorn best-practices congifuration guide. Heartbleed fixed.
# We use latest stable nginx with fresh **openssl**, **zlib** and **pcre** dependencies.
# Some extra handy modules to use: --with-http_stub_status_module --with-http_gzip_static_module
#
# Deployment structure
#
# SERVER:
# /etc/init.d/nginx (1. nginx)
# /home/app/public_html/app_production/current (Capistrano directory)
#
@wojtekmach
wojtekmach / account_test.rb
Created May 3, 2012 09:45
Writing MiniTest extensions
require 'minitest/autorun'
module MiniTest::Assertions
def assert_changes(obj, method, exp_diff)
before = obj.send method
yield
after = obj.send method
diff = after - before
assert_equal exp_diff, diff, "Expected #{obj.class.name}##{method} to change by #{exp_diff}, changed by #{diff}"
@them0nk
them0nk / rspec_rails_cheetsheet.rb
Created March 23, 2012 03:39
Rspec Rails cheatsheet (include capybara matchers)
#Model
@user.should have(1).error_on(:username) # Checks whether there is an error in username
@user.errors[:username].should include("can't be blank") # check for the error message
#Rendering
response.should render_template(:index)
#Redirecting
response.should redirect_to(movies_path)
@tsabat
tsabat / zsh.md
Last active December 25, 2023 19:16
Getting oh-my-zsh to work in Ubuntu
@brentertz
brentertz / rvm2rbenv.txt
Created November 21, 2011 23:00
Switch from RVM to RBENV
## Prepare ###################################################################
# Remove RVM
rvm implode
# Ensure your homebrew is working properly and up to date
brew doctor
brew update
## Install ###################################################################