This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Moved to: https://github.com/bmfurtado/iterm2-cssh |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private static final MethodHandles.Lookup LOOKUP = MethodHandles.lookup(); | |
private static final MethodHandles.Lookup PUBLOOKUP = MethodHandles.publicLookup(); | |
@Test | |
public void basics() throws Throwable { | |
// method invocation | |
String value1 = System.getProperty("java.home"); | |
System.out.println("Hello, world"); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Helpers | |
// ------- | |
// For slicing `arguments` in functions | |
var slice = Array.prototype.slice; | |
// Borrow the Backbone `extend` method so we can use it as needed | |
Marionette.extend = Backbone.Model.extend; | |
// A wrapper / shim for `Object.create`. Uses native `Object.create` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
license: gpl-3.0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// EXPERIMENTAL | |
// ------------ | |
// | |
// an idea for computed fields with Backbone.Model. | |
// total hack implementation, but basic idea works. | |
// use at your own risk. | |
// Entity With Computed Field | |
// -------------------------- |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@ChristinGorman gave this talk at JavaZone: https://vimeo.com/49484333 It's quite good, short, energetic, enthusiastic, | |
intelligent, and completely misses the point. | |
While it's true that the code she produces is much better than the original, and is quite easy to understand; it fails one | |
critical test. It's not polite. | |
Polite code is like a well written newspaper article. It allows you to bail out early. A well written article has a | |
headline, a synopsis, and a set of paragraphs that begin with the high level concepts and get more and more detailed as you | |
read through the article. At any point you can decide: "I get it! I don't need to read further." Indeed, this is how most | |
people read newspapers or magazines. The articles are polite, because they allow you to get out quickly. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@AtmosphereHandlerService(path="/chat", | |
interceptors = {AtmosphereResourceLifecycleInterceptor.class, BroadcastOnPostAtmosphereInterceptor.class}) | |
public class ChatAtmosphereHandler extends OnMessage<Data> { | |
private final ObjectMapper mapper = new ObjectMapper(); | |
@Override | |
public void onMessage(AtmosphereResponse response, Data message) throws IOException { | |
response.getWriter().write(mapper.writeValueAsString(data)); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
# Serve the current directory via HTTP. | |
# Like Python's SimpleHTTPServer, but with no-cache headers. | |
# Default port 8000, specify alternate port as first parameter: | |
# www 3000 | |
# sudo www 80 # (probably a bad idea) | |
# Inspired by http://chrismdp.github.com/2011/12/cache-busting-ruby-http-server/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash -ex | |
# Paste this into ssh | |
# curl -sL https://gist.github.com/andsens/2913223/raw/bootstrap_homeshick.sh | tar -xzO | /bin/bash -ex | |
# When forking, you can get the URL from the raw (<>) button. | |
### Set some command variables depending on whether we are root or not ### | |
# This assumes you use a debian derivate, replace with yum, pacman etc. | |
aptget='sudo apt-get' | |
chsh='sudo chsh' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |