Skip to content

Instantly share code, notes, and snippets.

🐢
Building the next thing

Shane Becker veganstraightedge

🐢
Building the next thing
Block or report user

Report or block veganstraightedge

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
@veganstraightedge
veganstraightedge / app_redirect.rb
Created Mar 27, 2018
Redirect `app.any-domain.tld` to `any-domain.tld` while keeping the path in place.
View app_redirect.rb
module Rack
class AppRedirect
def initialize(app)
@app = app
end
def call(env)
request = Rack::Request.new(env)
if request.host.start_with?("app.")
@veganstraightedge
veganstraightedge / shanes-sequence.rb
Last active Feb 22, 2018
Shane's Sequence of Prime Numbers. (Every prime-th prime.)
View shanes-sequence.rb
require 'prime'
output = []
current_index = 0
range = Prime.first(10000)
Prime.first(20).each do |next_prime|
output << range[current_index]
current_index += next_prime
end
View solidity_syntax_pygments.html
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title></title>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<style type="text/css">
td.linenos { background-color: #f0f0f0; padding-right: 10px; }
span.lineno { background-color: #f0f0f0; padding: 0 5px 0 5px; }
View heroku-cli-error
> heroku open -r staging
module.js:557
throw err;
^
Error: Cannot find module '@cli-engine/engine'
at Function.Module._resolveFilename (module.js:555:15)
at Function.Module._load (module.js:482:25)
at Module.require (module.js:604:17)
View convert.sh
find . -name \*.rb -exec perl -p -i -e 's/([^:]):(\w+)\s*=>/\1\2:/g' {} \;
@veganstraightedge
veganstraightedge / infura.rb
Last active Feb 26, 2018
The very start of what will likely become an Infura API wrapper gem. Lots TODO still.
View infura.rb
### Infura helper class
require "http"
require "json"
class Infura
NETWORK = :mainnet
API_BASE_URL = "https://api.infura.io/v1/jsonrpc/#{Infura::NETWORK}/"
class << self
View stuck.backtrace
vendor/ruby-2.5.0/lib/ruby/2.5.0/monitor.rb:185:in `lock': deadlock; recursive locking (ThreadError)
from vendor/ruby-2.5.0/lib/ruby/2.5.0/monitor.rb:185:in `mon_enter'
from vendor/ruby-2.5.0/lib/ruby/2.5.0/monitor.rb:224:in `mon_synchronize'
from vendor/bundle/ruby/2.5.0/gems/dalli-2.7.6/lib/dalli/options.rb:23:in `alive?'
from vendor/bundle/ruby/2.5.0/gems/dalli-2.7.6/lib/dalli/ring.rb:42:in `server_for_key'
from vendor/bundle/ruby/2.5.0/gems/dalli-2.7.6/lib/dalli/client.rb:361:in `perform'
from vendor/bundle/ruby/2.5.0/gems/dalli-2.7.6/lib/dalli/client.rb:181:in `incr'
from vendor/bundle/ruby/2.5.0/gems/dalli-2.7.6/lib/active_support/cache/dalli_store.rb:234:in `block (2 levels) in increment'
from vendor/bundle/ruby/2.5.0/gems/dalli-2.7.6/lib/dalli/client.rb:262:in `with'
from vendor/bundle/ruby/2.5.0/gems/dalli-2.7.6/lib/active_support/cache/dalli_store.rb:82:in `with'
@veganstraightedge
veganstraightedge / fizz_buzz_1.ex
Created May 22, 2017
Spent an hour or so with @zzak getting my first look at Elixir. We Fizz Buzzed. ¯\_(ツ)_/¯
View fizz_buzz_1.ex
defmodule FizzBuzz do
def run do
range = 1..10
Enum.each range, fn i -> print_eye(i) end
end
def print_eye i do
cond do
rem(i, 3) == 0 ->
IO.puts "Fizz"
View magnified-plaid.json
{
"items": [{
"type": ["h-event"],
"properties": {
"author": [{
"value": "gRegor Morrill",
"type": ["h-card"],
"properties": {
"photo": ["/assets/img/profile.jpg"],
"name": ["gRegor Morrill"],
View 2.9-post-install-message.txt
"Calling all. This is our last cry before our eternal silence."
- The 2.X version.
Coming VERY SOON: The 3.0 Version!
3.0 is a nearly complete re-write of the Microformats Ruby parser.
3.0 will fix almost all outstanding issues on the GitHub repo,
add classical Microformats support and more! But unfortunately,
the cost of doing this is that there will be some breaking changes
and changing API.
You can’t perform that action at this time.