Skip to content

Instantly share code, notes, and snippets.

Stujo stujo

  • San Francisco, CA
View GitHub Profile
@stujo
stujo / GitHub curl.sh
Last active Feb 15, 2019 — forked from Integralist/GitHub curl.sh
Download a single file from a private GitHub repo. You'll need an access token as described in this GitHub Help article: https://help.github.com/articles/creating-an-access-token-for-command-line-use
View GitHub curl.sh
#!/usr/bin/env bash
TOKEN="INSERTACCESSTOKENHERE"
OWNER="BBC-News"
REPO="responsive-news"
FILE_PATH="scripts/build/tabloid.sh"
FILE="https://api.github.com/repos/$OWNER/$REPO/contents/$FILE_PATH"
curl --header "Authorization: token $TOKEN" \
--header 'Accept: application/vnd.github.v3.raw' \
@stujo
stujo / ab.sh
Created Apr 3, 2018 — forked from brentertz/ab.sh
Apache Bench - Load test a protected page
View ab.sh
#!/bin/bash
COOKIE_JAR="ab-cookie-jar"
COOKIE_NAME="_myapp_session"
USERNAME="foo@bar.com"
PASSWORD="password"
LOGIN_PAGE_URI="http://localhost:3000/users/sign_in"
TEST_PAGE_URI="http://localhost:3000/dashboard"
echo "Logging in and storing session id."
@stujo
stujo / ab.sh
Created Apr 3, 2018 — forked from brentertz/ab.sh
Apache Bench - Load test a protected page
View ab.sh
#!/bin/bash
COOKIE_JAR="ab-cookie-jar"
COOKIE_NAME="_myapp_session"
USERNAME="foo@bar.com"
PASSWORD="password"
LOGIN_PAGE_URI="http://localhost:3000/users/sign_in"
TEST_PAGE_URI="http://localhost:3000/dashboard"
echo "Logging in and storing session id."
@stujo
stujo / atom_helper_sample.txt
Created Jan 24, 2017
Atom Helper Sample During Freeze with webpack esformatter and eslint
View atom_helper_sample.txt
Sampling process 7644 for 3 seconds with 1 millisecond of run time between samples
Sampling completed, processing symbols...
Analysis of sampling Atom Helper (pid 7644) every 1 millisecond
Process: Atom Helper [7644]
Path: /Applications/Atom.app/Contents/Frameworks/Atom Helper.app/Contents/MacOS/Atom Helper
Load Address: 0x10279b000
Identifier: com.github.atom.helper
Version: 1.13.0 (1.13.0)
Code Type: X86-64
Parent Process: Atom [6943]
@stujo
stujo / session-auth-sinatra-app.rb
Created Jan 6, 2017
sinatra session auth example (without database)
View session-auth-sinatra-app.rb
require 'sinatra'
enable :sessions
# helpers/session_helper.rb
helpers do
def session_user_id
session[:user_id]
end
@stujo
stujo / codewars-test-stubs.js
Last active Jan 2, 2017
code-wars-test-stubs.js
View codewars-test-stubs.js
var Test = {
describe: Test_describe,
before: Test_before,
expect: Test_expect,
it: Test_it,
context: Test_context,
contexts: [],
assertEquals: Test_assertEquals,
logError: Test_logError,
logSuccess: Test_logSuccess,
@stujo
stujo / example-extends-vs-includes.rb
Last active Dec 19, 2016
How to include a module
View example-extends-vs-includes.rb
module Timeable
def start_timer
@timeable_timer = Time.now.utc
end
def end_timer
Time.now.utc - @timeable_timer
end
end
class DragRace
@stujo
stujo / mutable_string.rb
Last active Dec 19, 2016
Mutable Strings in Ruby
View mutable_string.rb
puts "Assign bob = \"bob\""
bob = "bob"
puts "bob_smith is also a bob"
puts "So bob_smith = bob (the variable reference)"
bob_smith = bob
puts "We want to capitalize bob so : bob.capitalize!"
@stujo
stujo / abstract_method_pattern.rb
Created Dec 12, 2016
Using Mix-Ins with the Abstract Method Pattern
View abstract_method_pattern.rb
# The SuperPower blast_them method depends on the abstract method projectile
module Blastable
def blast_them
puts "BLASTING: #{projectile} (#{self.class.name})"
end
end
class Tyrannosaurus
include Blastable
View rsk_run_lint.txt
$ npm run lint
> @ lint
> npm run lint:js && npm run lint:css
> @ lint:js
> eslint src tools
You can’t perform that action at this time.