$ rails g model User
belongs_to
has_one
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 |
#!/usr/bin/env ruby | |
# checkout the readme from the master branch | |
`git checkout gh-pages; git checkout master README.md` | |
path = `pwd`.gsub(/\n/, "") | |
readme_path = File.join(path, "README.md") | |
index_path = File.join(path, "index.md") | |
# write the index readme file |
This is just a jotting of notes on how to embed Faye into a single Rails process. Makes it nice to do simple real time things without the need for a separate Faye server/process.
Also uses Faye Redis to work across load balanced Rails apps.
You also need to copy the compiled javascript into vendor/assets/javascripts
and include into application.js
manifest.
Ignore the numbers in the file names... just used to add order to the Gist.
This uses the faye/faye Github repo at edc5b42f6560d31eae61caf00f6765a90e1818d1
since I wanted to use with the Puma rack server and that is only available in the master branch (until Faye 1.0)
import com.google.api.client.auth.oauth2.Credential; | |
import com.google.api.client.auth.oauth2.TokenResponse; | |
import com.google.api.client.googleapis.auth.oauth2.GoogleAuthorizationCodeFlow; | |
import com.google.api.client.googleapis.auth.oauth2.GoogleAuthorizationCodeRequestUrl; | |
import com.google.api.client.googleapis.auth.oauth2.GoogleCredential; | |
import com.google.api.client.googleapis.auth.oauth2.GoogleTokenResponse; | |
import com.google.api.client.http.GenericUrl; | |
import com.google.api.client.http.HttpRequest; | |
import com.google.api.client.http.HttpRequestFactory; | |
import com.google.api.client.http.HttpTransport; |
### Install Oracle Java 8, this means you agree to their binary license!! | |
cd ~ | |
sudo add-apt-repository -y ppa:webupd8team/java | |
sudo apt-get update | |
echo debconf shared/accepted-oracle-license-v1-1 select true | sudo debconf-set-selections | |
echo debconf shared/accepted-oracle-license-v1-1 seen true | sudo debconf-set-selections | |
sudo aptitude -y install oracle-java8-installer | |
### Download and Install ElasticSearch |
'use strict'; | |
var Octokat = require('octokat'); | |
var extend = require('lodash/object/assign'); | |
var defaults = { | |
branchName: 'master', | |
token: '', | |
username: '', | |
reponame: '' |
import cookielib | |
import os | |
import urllib | |
import urllib2 | |
from bs4 import BeautifulSoup | |
import re | |
# Datos de la cuenta de siding | |
username = "<username>" |
REGEDIT4 | |
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Fonts] | |
"Segoe Print (TrueType)"="consola.ttf" | |
"Segoe Print Bold (TrueType)"="consolab.ttf" |
An Orrery in pure CSS3 (ok, Sass generated). Still WIP. Having great fun with it!
A Pen by Tady Walsh on CodePen.