Skip to content

Instantly share code, notes, and snippets.

View weapp's full-sized avatar
💸

Manuel Albarran weapp

💸
View GitHub Profile
@weapp
weapp / Gemfile
Created January 10, 2023 16:45 — forked from caendekerk/Gemfile
Rails API only with Okta but without Devise
source 'https://rubygems.org'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '~> 6.0.0'
# Shorten boot time
gem 'bootsnap'
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
gem 'jbuilder', github: 'rails/jbuilder'
@weapp
weapp / Gemfile
Created June 25, 2020 10:22 — forked from dhh/Gemfile
HEY's Gemfile
ruby '2.7.1'
gem 'rails', github: 'rails/rails'
gem 'tzinfo-data', '>= 1.2016.7' # Don't rely on OSX/Linux timezone data
# Action Text
gem 'actiontext', github: 'basecamp/actiontext', ref: 'okra'
gem 'okra', github: 'basecamp/okra'
# Drivers
@weapp
weapp / optparse-template.rb
Created May 29, 2019 06:48 — forked from rtomayko/optparse-template.rb
Ruby optparse template
#!/usr/bin/env ruby
#/ Usage: <progname> [options]...
#/ How does this script make my life easier?
# ** Tip: use #/ lines to define the --help usage message.
$stderr.sync = true
require 'optparse'
# default options
flag = false
option = "default value"
#!/usr/bin/env ruby
require "bundler/inline"
gemfile do
source "https://rubygems.org"
gem "rack"
gem "foxy", git: "git://github.com/weapp/foxyrb.git"
end
class App
class Field
attr_accessor :name, :type, :default
def initialize(name, type, default)
@name = name.to_s
@type = type
@default = default
end
TYPECASTS = {
defmodule PROJECT_NAME.MODULE_NAMETest do
use ExUnit.Case
alias PROJECT_NAME.MODULE_NAME
doctest MODULE_NAME
describe "description" do
setup do
%{
@weapp
weapp / Gemfile
Created May 30, 2017 20:35
dummy foxy example
source "https://rubygems.org"
gem "foxy"
group :development, :test do
gem "pry"
gem "pry-byebug"
end

%title: Splats: beyond *args %author: weapp %date: 2017-04-20

-> # What is * (splat) <-

by urbandictionary

defmodule MyMap do
def bodyrecursive([]) do [] end
def bodyrecursive([h|t]) do [h + 1 | bodyrecursive(t)] end
def generic_bodyrecursive([], _) do [] end
def generic_bodyrecursive([h|t], fun) do [fun.(h) | bodyrecursive(t)] end
def tail(list) do tail(list, []) end
defp tail([], acc) do :lists.reverse(acc) end
defp tail([h|t], acc) do tail(t, [h + 1 | acc]) end
defmodule Mod do
@table %{
a: 1, b: 2, c: 3, d: 4, e: 5,
f: 6, g: 7, h: 8, i: 9, j: 0,
}
def fun1(k) do @table[k] end
for {k, v} <- @table do
def fun2(unquote(k)) do unquote(v) end