Skip to content

Instantly share code, notes, and snippets.

@jboner
jboner / latency.txt
Last active May 10, 2025 11:02
Latency Numbers Every Programmer Should Know
Latency Comparison Numbers (~2012)
----------------------------------
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
@iambibhas
iambibhas / scopes.txt
Last active January 25, 2025 20:07
Sublime Text 2: Snippet scopes
Here is a list of scopes to use in Sublime Text 2 snippets -
ActionScript: source.actionscript.2
AppleScript: source.applescript
ASP: source.asp
Batch FIle: source.dosbatch
C#: source.cs
C++: source.c++
Clojure: source.clojure
CoffeeScript: source.coffee

Checklist for Heroku/Sinatra/Active Record App Deployment

1. Write your app - YAY!

2. Prepare Your App

  • Set up your environments.rb file

    • mkdir config
    • touch config/environments.rb
  • Set it up thusly:

Checklist for Heroku/Sinatra/Active Record App Deployment

Prepare Your App

Set up your environments.rb file:

  • mkdir config
  • touch environments.rb
  • set up thusly:

Applications of Cognitive Theory in Data Modeling and Software Design

Written as both a refresher course on the mechanics of cognition in human psychology, and as the beginning of a working theory, wherein one might make some deductions from human psychology to broadly advance/improve the design of server software and data models for the industry en masse.

c. Mike McNeil, 2013-2014 All Rights Reserved.

What's the point of this? I think psychology will inevetiably instruct the future of software design, in the same way neurobiology is beginning to impact the hardware engineering industry. >

@peterc
peterc / methods_returning.rb
Last active October 29, 2023 03:10
Object#methods_returning - to work out which method on an object returns what we want
require 'stringio'
require 'timeout'
class Object
def methods_returning(expected, *args, &blk)
old_stdout = $>
$> = StringIO.new
methods.select do |meth|
Timeout::timeout(1) { dup.public_send(meth, *args, &blk) == expected rescue false } rescue false
@JustinData
JustinData / installfest.md
Last active August 29, 2015 13:59
Ubuntu Linux Installfest

Installing Tools

  1. [HipChat][hipchat]
  • Google Chrome
    • sudo apt-get install libxss1
    • wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
    • sudo dpkg -i google-chrome*.deb
  • [Install Ruby + Rails][rails] (Be sure to read the below instructions before going to the linked guide.)
    • In the linked guide when you get to generating you SSH key, as you're generating the key it requests a location to create the files, use the example the prompt provides. *If you create a psscode when generating the key, you will be prompted for the passcode when testing the connection.
# https://talent-hack.atlassian.net/browse/TAL-908
client_email = '[email protected]'
talent_email = '[email protected]'
pass_title = 'Monthly Unlimited Virtual Classes - Reoccurring'
# References involved
client_user = User.find_by(email: client_email)
talent_user = User.find_by(email: talent_email)
pass = Pass.find_by(user_id: talent_user.id, title: pass_title)
# Swift Language Fundamentals
Swift is a modern programming language for Apple platforms (iOS, macOS, etc.) with these key characteristics:
1. Core Features:
- Type inference for automatic type detection
- Optionals for safe handling of missing values
- Closures for flexible function passing
- Memory safety by design
- Built-in error handling