Skip to content

Instantly share code, notes, and snippets.

View thejones's full-sized avatar

Alex Jones thejones

  • NA
  • Alberta
  • 01:39 (UTC -06:00)
View GitHub Profile
@thejones
thejones / index.html
Last active February 3, 2021 18:40
Repo as line
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Repos</title>
<script src="https://cdn.amcharts.com/lib/4/core.js"></script>
<script src="https://cdn.amcharts.com/lib/4/charts.js"></script>
@thejones
thejones / index.html
Last active February 2, 2021 17:44
repo as cal
<html>
<head>
<script type="text/javascript" src="https://www.gstatic.com/charts/loader.js"></script>
<script type="text/javascript">
google.charts.load("current", {packages:["calendar"]});
google.charts.setOnLoadCallback(drawChart);
function drawChart() {
var dataTable = new google.visualization.DataTable();
dataTable.addColumn({ type: 'date', id: 'Date' });
@thejones
thejones / covid_rapid_test_afc_urgent_care_form.js
Last active November 22, 2020 19:18
COVID rapid test for AFC Urgent Care in Denver
// Paste this into the console. Does not sumbit so you can review.
(function fillForm(){
document.getElementById('first-name').value = 'First';
document.getElementById('last-name').value = 'Last';
document.getElementById('phone-number').value = '646-919-8260';
document.getElementById('dob').value = "1990-01-21";
radiobtn = document.getElementById("male"); // or female
radiobtn.checked = true;
document.getElementById('symptoms').value = 'Your Reason';
@thejones
thejones / phoenix_router_example.ex
Last active March 22, 2020 14:59
TheDev Academy
defmodule AppWeb.Router do
use AppWeb, :router
use Pow.Phoenix.Router
use PowAssent.Phoenix.Router
pipeline :browser do
plug :accepts, ["html"]
plug :fetch_session
plug :fetch_live_flash
plug :put_root_layout, {AppWeb.LayoutView, :root}

Keybase proof

I hereby claim:

  • I am thejones on github.
  • I am alextjones (https://keybase.io/alextjones) on keybase.
  • I have a public key ASB2MEYov4-giXvKdynq_1fRntLhCP9-R7F4HJg0XG0DGQo

To claim this, I am signing this object:

@thejones
thejones / router-example.js
Created April 19, 2019 14:03
Example of an express router showing that the error we capture, log and return are all different.
const os = require('os'); //used to get host name
/*
Logger - ability to log everything about the error
We can format whatever we need and add stacktrace info to errors.
nutrien-logger - we use Pino for this
*/
const logger = {
info: (err) => console.log(`
@thejones
thejones / pg_stat_statements setup.txt
Last active November 30, 2018 16:57
pg_stat_statements setup that worked for me.
1. Conf file changes
A.
SHOW config_file; -- find the location of the correct conf file to edit...
B.
shared_preload_libraries = pg_stat_statements (required)
track_activity_query_size = 2048 (increase maximum length before which queries are truncated)
pg_stat_statements.track = ALL (track all statements, including those inside stored procedures)
2.
@thejones
thejones / index.js
Created November 12, 2018 14:09
Save express routes to file (express-list-endpoints)
const listEndpoints = require('express-list-endpoints')
var app = express();
//express setup
//then list them
// This is quick and dirty (no error probably cannot be run more than once correctly)
fs.mkdir(__dirname + "/tmp/", { recursive: true }, (err) => {
@thejones
thejones / voting-page.js
Last active October 26, 2017 18:25
voting-page change line 501
AKSHOF = window.AKSHOF || {};
AKSHOF.app = angular.module("AKSHOF", []);
AKSHOF.app.directive("vote", function() {
return {
require: "ngModel",
restrict: "A",
link: function(scope, elem, attrs, ngModel) {
var parts = attrs.vote.split(",");
var kind = parts[0].trim();
@thejones
thejones / Controller.rb
Created June 1, 2017 04:28
Sample Rails Controller
class TeamsController < ApplicationController
before_action :authenticate_user!, only: [:edit, :update, :destroy, :join, :leave, :remove]
before_action :set_challenge, only: [:index]
#before_action :set_team_milage_totals, only: [:index]
before_action :set_team, only: [:show, :edit, :update, :destroy, :join, :leave, :remove]
before_action :set_industry, only: [:show, :edit, :update, :destroy, :join, :leave]
before_action :require_permission, only: [:edit, :destroy, :remove]
before_action :set_user, only: [:remove]
before_action :require_same_team, only: [:remove]