Create an empty git repo or reinitialize an existing one
git init| # VCL for Varnish - How to cache your dynamic pages | |
| # SFPHP.org Apr 9, 2013 | |
| # See: https://github.com/varnish/libvmod-header | |
| # This varnish mod allows us to easily manipulate the Set-Cookie responses | |
| import header; | |
| probe varnish_probe { | |
| .url = "/ping"; | |
| .timeout = 2s; |
Create an empty git repo or reinitialize an existing one
git init| package com.gilbert.wat.widget; | |
| import java.lang.reflect.Field; | |
| import java.lang.reflect.Method; | |
| import java.util.Calendar; | |
| import android.app.DatePickerDialog; | |
| import android.content.Context; | |
| import android.os.Build; | |
| import android.widget.DatePicker; |
| //This sample is how to use websocket of Tomcat. | |
| package wsapp; | |
| import java.io.IOException; | |
| import java.nio.ByteBuffer; | |
| import java.nio.CharBuffer; | |
| import java.util.ArrayList; | |
| import org.apache.catalina.websocket.MessageInbound; | |
| import org.apache.catalina.websocket.StreamInbound; | |
| import org.apache.catalina.websocket.WebSocketServlet; |
| 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 |
| # Google Art Project fullsize image downloader. | |
| # By Henrik Nyh <http://henrik.nyh.se> 2011-02-05 under the MIT license. | |
| # Requires Ruby and ImageMagick. | |
| # | |
| # Usage e.g.: | |
| # ruby google_art_project.rb http://www.googleartproject.com/museums/tate/portrait-of-william-style-of-langley-174 | |
| # | |
| # You can specify multiple URLs on the command line, separated by space. | |
| # Or you can specify no URLs on the command line and instead list them at the end of this file, one on each line, | |
| # with "__END__" before the list. |
OxJs (speak: HexaJs) is a utility library for javascript, that facilitates parsing and creation of binary data in Javascript. While this sounds weird in the first moment, there are a few areas where OxJs can come in handy:
If you need to transfer huge amounts of numercial data via AJAX, binary encoding can be much more space-efficient than transfering it in JSON. The number 41239 for example needs 5 Bytes in JSON, but only 2 Bytes in binary encoding (unsigned short). A more practical example is the The Google Maps Polyline Utility, which saves over 80% of the json payload by binary encoding. However, de- and encoding binary information can be a quite tricky and this is were OxJs helps.
For client-side file parsing: Recent enhancements in Javascript allow us byte access for to-be-uploaded files. This can be used to perform enhanced sanity che