Skip to content

Instantly share code, notes, and snippets.

:shipit:
Shipping

John Barker barkerja

:shipit:
Shipping
Block or report user

Report or block barkerja

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
@barkerja
barkerja / latency.txt
Created Apr 9, 2018 — forked from jboner/latency.txt
Latency Numbers Every Programmer Should Know
View latency.txt
Latency Comparison Numbers
--------------------------
L1 cache reference 0.5 ns
Branch mispredict 5 ns
L2 cache reference 7 ns 14x L1 cache
Mutex lock/unlock 25 ns
Main memory reference 100 ns 20x L2 cache, 200x L1 cache
Compress 1K bytes with Zippy 3,000 ns 3 us
Send 1K bytes over 1 Gbps network 10,000 ns 10 us
Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD
@barkerja
barkerja / About.md
Created Mar 13, 2017 — forked from melicarls/About.md
React.js Lightning Talk
View About.md

React.js

What is React.js?

React is a "declarative, efficient, and flexible Javascript library for building user interfaces." It was created by Facebook, first deployed in 2011, and was open-sourced in 2013. It is one of many answers to everyone's favorite question: "how should we structure Javascript applications on the web?"

Goal:

Minimize the amount of mutation that developers have to deal with by totally redoing the view every time that the data on a page changes. The developer writes the code for the page's first load but never has to account for modifications since every change to the page is treated like that initial render!

@barkerja
barkerja / the-bind-problem.jsx
Created Nov 28, 2016 — forked from Restuta/the-bind-problem.jsx
React, removeEventListener and bind(this) gotcha
View the-bind-problem.jsx
/* Sometimes it's pretty easy to run ito troubles with React ES6 components.
Consider the following code: */
class EventStub extends Component {
componentDidMount() {
window.addEventListener('resize', this.onResize.bind(this)); //notice .bind
}
componentWillUnmount() {
window.removeEventListener('resize', this.onResize.bind(this));
View twitter_unfollow.rb
require 'twitter'
require 'csv'
require 'date'
# Define the cut off, in days:
tweet_cliff = 180
client = Twitter::REST::Client.new do |c|
c.consumer_key = ''
c.consumer_secret = ''
View overwatch_counters.json
{
"ana" : ["lucio", "zenyatta", "mercy"],
"bastion" : ["reinhardt", "torbjorn", "winston"],
"dva" : ["pharah", "widowmaker", "reinhardt"],
"genji" : ["bastion", "mercy", "widowmaker"],
"hanzo" : ["torbjorn","bastion", "widowmaker"],
"junkrat" : ["bastion", "mei", "torbjorn"],
"lucio" : ["winston", "dva", "reaper"],
"mccree" : ["reaper", "tracer", "winston"],
"mei" : ["winston", "tracer", "genji"],
View keybase.md

Keybase proof

I hereby claim:

  • I am barkerja on github.
  • I am barkerja (https://keybase.io/barkerja) on keybase.
  • I have a public key whose fingerprint is 4511 FC98 FCF2 8ADE ACE9 1682 4DED 2BE8 89D9 4983

To claim this, I am signing this object:

@barkerja
barkerja / nginx.conf
Created Feb 13, 2016 — forked from plentz/nginx.conf
Best nginx configuration for improved security(and performance). Complete blog post here http://tautt.com/best-nginx-configuration-for-security/
View nginx.conf
# to generate your dhparam.pem file, run in the terminal
openssl dhparam -out /etc/nginx/ssl/dhparam.pem 2048
@barkerja
barkerja / GIF-Screencast-OSX.md
Last active Sep 12, 2015 — forked from dergachev/GIF-Screencast-OSX.md
OS X Screencast to animated GIF
View GIF-Screencast-OSX.md

OS X Screencast to animated GIF

This gist shows how to create a GIF screencast using only free OS X tools: QuickTime, ffmpeg, and gifsicle.

Screencapture GIF

Instructions

To capture the video (filesize: 19MB), using the free "QuickTime Player" application:

View rebuild_rethinkdb_indexes.rb
include RethinkDB::Shortcuts
conn = r.connect(host: ENV['RETHINKDB_URL'])
databases = r.db_list().run(conn)
databases.each do |database|
puts "Database: #{database}"
tables = r.db(database).table_list().run(conn)
View db.rake
namespace :db do
namespace :enable do
desc "enable hstore extension"
task :hstore => [:environment, :load_config] do
ActiveRecord::Base.connection.execute('CREATE EXTENSION IF NOT EXISTS hstore;')
end
end
Rake::Task['db:schema:load'].enhance ['db:enable:hstore']
end
You can’t perform that action at this time.