Skip to content

Instantly share code, notes, and snippets.

View themusicman's full-sized avatar
🏠
Working from home

Thomas Brewer themusicman

🏠
Working from home
View GitHub Profile
# https://www.atlassian.com/git/tutorials/dotfiles
git clone --bare https://bitbucket.org/durdn/cfg.git $HOME/.cfg
function config {
/usr/bin/git --git-dir=$HOME/.cfg/ --work-tree=$HOME $@
}
mkdir -p .config-backup
config checkout
if [ $? = 0 ]; then
echo "Checked out config.";
@themusicman
themusicman / help.ex
Created June 10, 2024 13:38
Elixir Help Module
defmodule Help do
@moduledoc false
defmacro __using__(_opts) do
quote do
import Ecto.Changeset
import Ecto.Query
# other import, alais, and code ...
:ok
[debug] Elixir.ER.Destinations.Manager.Server.start_destination_pipeline(%ER.Destinations.Destination{__meta__: #Ecto.Schema.Metadata<:loaded, "destinations">, id: "a23e555e-460d-4e32-9eb6-13da92897a22", name: "s3_users", offset: nil, ordered: false, destination_type: :s3, paused: false, config: %{"s3_bucket" => "eventrelay-dev", "s3_region" => "us-east-2"}, config_json: nil, topic_identifier: nil, group_key: nil, signing_secret: "X1KFbu42hJ2GOf6jcbKrRHIBGWjJ0djHMiffeD4X3fr5cWsxYP_bH7cF6wr464vs", query: nil, topic_name: "users", topic: #Ecto.Association.NotLoaded<association :topic is not loaded>, inserted_at: ~U[2024-01-02 21:14:01Z], updated_at: ~U[2024-01-02 21:14:01Z]} starting pipeline. pipeline=ER.Destinations.Pipeline.S3
[debug] Elixir.ER.Destinations.Pipeline.S3.child_spec with child_spec=%{id: "Elixir.ER.Destinations.Pipeline.S3:base:destination:pipeline:s3:a23e555e-460d-4e32-9eb6-13da92897a22", shutdown: :infinity, start: {ER.Destinations.Pipeline.S3, :start_link, [[destination: %ER.Destinations.Des
@themusicman
themusicman / gist:58908ebdf708c4dc8118cee23ff71fde
Created February 2, 2022 13:38
TokBox streamDestroyed event
{
"type": "streamDestroyed",
"cancelable": true,
"_defaultPrevented": false,
"stream": {
"id": "7e24f084-d971-46d6-936d-ced2ba4e2817",
"streamId": "7e24f084-d971-46d6-936d-ced2ba4e2817",
"name": "",
"creationTime": 1643809018166,
"connection": {
@themusicman
themusicman / recipe-updating-maps
Created June 5, 2019 13:35
Updating Maps in Elixir
# A map in Elixir is a key => value data structure
thomas = %{first_name: "Thomas", age: 38, job_title: "Director of Awesome"}
# There are multiple ways to update a Map in Elixir like
# put/3 - https://hexdocs.pm/elixir/Map.html#put/3
thomas = Map.put(thomas, :age, 39)
%{first_name: "Thomas", age: 39, job_title: "Director of Awesome"}
# merge/2 - https://hexdocs.pm/elixir/Map.html#merge/2
<a href="http://spammer-site.com" rel="nofollow">Look at me</a>
@themusicman
themusicman / elasticsearch-model-example.rb
Last active February 9, 2016 19:44
Increasing the size of the search records returned
Legislator.search(params[:q], size: 10000).records.where(chamber: params[:chamber]).order('voting_sessions.score asc, last_name asc')
@themusicman
themusicman / spec_helper.rb
Last active December 13, 2015 22:49
spec_helper for Padrino that adds support for assigns(:model_name) in controller specs.
PADRINO_ENV = 'test' unless defined?(PADRINO_ENV)
require File.expand_path(File.dirname(__FILE__) + "/../config/boot")
module Padrino
module RspecHelpers
def self.registered(app)
app.set :delivery_method, :test
@themusicman
themusicman / pi.rangee.php
Created November 29, 2012 15:34
Simple Little Date Range Plugin
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
/**
* ExpressionEngine - by EllisLab
*
* @package ExpressionEngine
* @author ExpressionEngine Dev Team
* @copyright Copyright (c) 2003 - 2011, EllisLab, Inc.
* @license http://expressionengine.com/user_guide/license.html
* @link http://expressionengine.com
@themusicman
themusicman / add-states.html
Created November 7, 2012 14:24
Generate State Categories
<?php
$category_group = 9;
$site_id = 1;
$state_list = array(
'AL'=>"Alabama",
'AK'=>"Alaska",
'AZ'=>"Arizona",
'AR'=>"Arkansas",