Skip to content

Instantly share code, notes, and snippets.

🕉
finding my happy place...

Sonny Scroggin scrogson

🕉
finding my happy place...
Block or report user

Report or block scrogson

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
View keybase.md

Keybase proof

I hereby claim:

  • I am scrogson on github.
  • I am scrogson (https://keybase.io/scrogson) on keybase.
  • I have a public key ASDCQthqJvMSr2oa_EFbEiJAcnQmuQZuW1sGh80eE3jzVwo

To claim this, I am signing this object:

View beam_opcodes.erl
-module(beam_opcodes).
%% Warning: Do not edit this file.
%% Auto-generated by 'beam_makeops'.
-export([format_number/0]).
-export([opcode/2,opname/1]).
-spec format_number() -> 0.
format_number() -> 0.
@scrogson
scrogson / assigns.rs
Created Jul 10, 2017
Assigns like Plug's conn.assigns - but type safe
View assigns.rs
use ::std::collections::HashMap;
use ::std::any::{TypeId, Any};
struct Assigns {
map: HashMap<TypeId, Box<Any>>,
}
trait AssignHandle {
type MapsTo;
}
@scrogson
scrogson / router.rs
Created Jul 8, 2017
Basic Rust HTTP Router
View router.rs
#![allow(dead_code)]
use std::collections::HashMap;
type Headers = HashMap<String, String>;
type BoxedCallback = Box<Fn(Conn) -> Conn>;
#[derive(Default)]
struct Request {
method: String,
url: String,
@scrogson
scrogson / main.go
Last active Jul 10, 2017
Fetch current on call users from Pager Duty for a given schedule_id
View main.go
package main
import (
"encoding/json"
"fmt"
"log"
"net/http"
"net/url"
"time"
@scrogson
scrogson / docs.publish.ex
Last active Jul 10, 2017
A Mix Task to Publish docs to GitHub Pages
View docs.publish.ex
defmodule Mix.Tasks.Docs.Publish do
use Mix.Task
@shortdoc "Publishes docs to GitHub Pages"
@moduledoc """
Publishes docs to GitHub Pages.
mix docs.publish [git-remote]
View server.ex
defp gen_jwk_set do
{:ok, pem} = genrsa(2048)
pem
|> JOSE.JWK.from_pem()
|> JOSE.JWK.to_public()
|> JOSE.JWK.to_record()
|> List.wrap()
|> :jose_jwk_set.to_map(%{})
|> Poison.encode()
View phoenix_ws.rs
// OK so to start with here's the EventHandler trait, just like slack-rs
pub trait EventHandler {
// I don't know what kind of thing EventData should be.
// maybe Json? whatever events actually are in phoenix.
fn on_event(&mut self, channel_name: &str, event_type: &str, event_data: EventData);
fn on_connect(&mut self, ...);
fn on_close(&mut self, ...);
}
fn login_and_run<H: EventHandler>(handler: H, ...) {...}
@scrogson
scrogson / README
Last active May 8, 2018 — forked from ciastek/README
Use bootstrap-sass npm package with Phoenix's brunch
View README
1) install npm packages
2) update brunch-config.js
3) remove Bootstrap from web/static/css/app.css
4) rename web/static/css/app.css to web/static/css/app.scss
5) update web/static/css/app.scss
You can’t perform that action at this time.