Skip to content

Instantly share code, notes, and snippets.

View mohnish's full-sized avatar

Mohnish Thallavajhula mohnish

View GitHub Profile

1. SYSTEM

$ uname –a                          # Display linux system information
$ uname –r                          # Display kernel release information (refer uname command in detail)
$ hostname                          # Show system host name
$ hostname -i                       # Display the IP address of the host (all options hostname)
$ uptime                            # Show how long system running + load (learn uptime command)
$ last reboot                       # Show system reboot history (more examples last command)
$ cat /etc/redhat_release           # Show which version of redhat installed 

$ date # Show the current date and time (options of date command)

# Keyword arguments cannot be filled positionally:
def m(foo: 1, bar: 2)
[foo, bar]
end
method(:m).parameters # => [[:key, :foo], [:key, :bar]]
m # => [1, 2]
m(1, 2) rescue $! # => ArgumentError
m(foo: 2) # => [2, 2]
m(bar: 1) # => [1, 1]
class X.Example extends X.Object
@proxyMethod "attachmentManager.manageAttachment"
# Equivalent to:
# manageAttachment: ->
# @attachmentManager.manageAttachment.apply(@attachmentManager, arguments)
@proxyMethod "delegate?.compositionDidChangeDocument"
# Equivalent to:
# compositionDidChangeDocument: ->
# @delegate?.compositionDidChangeDocument?.apply(@delegate, arguments)

2015-01-29 Unofficial Relay FAQ

Compilation of questions and answers about Relay from React.js Conf.

Disclaimer: I work on Relay at Facebook. Relay is a complex system on which we're iterating aggressively. I'll do my best here to provide accurate, useful answers, but the details are subject to change. I may also be wrong. Feedback and additional questions are welcome.

What is Relay?

Relay is a new framework from Facebook that provides data-fetching functionality for React applications. It was announced at React.js Conf (January 2015).

How to set up stress-free SSL on an OS X development machine

One of the best ways to reduce complexity (read: stress) in web development is to minimize the differences between your development and production environments. After being frustrated by attempts to unify the approach to SSL on my local machine and in production, I searched for a workflow that would make the protocol invisible to me between all environments.

Most workflows make the following compromises:

  • Use HTTPS in production but HTTP locally. This is annoying because it makes the environments inconsistent, and the protocol choices leak up into the stack. For example, your web application needs to understand the underlying protocol when using the secure flag for cookies. If you don't get this right, your HTTP development server won't be able to read the cookies it writes, or worse, your HTTPS production server could pass sensitive cookies over an insecure connection.

  • Use production SSL certificates locally. This is annoying

/*!
* quantize.js Copyright 2008 Nick Rabinowitz.
* Licensed under the MIT license: http://www.opensource.org/licenses/mit-license.php
*/
// fill out a couple protovis dependencies
/*!
* Block below copied from Protovis: http://mbostock.github.com/protovis/
* Copyright 2010 Stanford Visualization Group
* Licensed under the BSD License: http://www.opensource.org/licenses/bsd-license.php

Spurred by recent events (https://news.ycombinator.com/item?id=8244700), this is a quick set of jotted-down thoughts about the state of "Semantic" Versioning, and why we should be fighting the good fight against it.

For a long time in the history of software, version numbers indicated the relative progress and change in a given piece of software. A major release (1.x.x) was major, a minor release (x.1.x) was minor, and a patch release was just a small patch. You could evaluate a given piece of software by name + version, and get a feeling for how far away version 2.0.1 was from version 2.8.0.

But Semantic Versioning (henceforth, SemVer), as specified at http://semver.org/, changes this to prioritize a mechanistic understanding of a codebase over a human one. Any "breaking" change to the software must be accompanied with a new major version number. It's alright for robots, but bad for us.

SemVer tries to compress a huge amount of information — the nature of the change, the percentage of users that wil

//
// Usage... for a nested structure
// var test = {
// nested: {
// value: 'Read Correctly'
// }
// };
// safeRead(test, 'nested', 'value'); // returns 'Read Correctly'
// safeRead(test, 'missing', 'value'); // returns ''
//
@mohnish
mohnish / gist:8581294
Created January 23, 2014 16:08 — forked from tj/gist:1424433
λ ~: brew list
ack faad2 httperf libvorbis nspr redis tokyo-cabinet
agrep ffmpeg httping libvpx optipng redis-tools tokyo-tyrant
base64 gd hub libwmf pango riak tree
bash-completion gettext icu4c libxml2 pcre rlwrap vnstat
boost giflib imagemagick little-cms pcre++ rrdtool watch
cairo gist intltool llvm peg ruby webkit2png
cloc git irssi lua pidof scons wget
cmake git-extras jasper man2html pixman sdl x264
couchdb git-flow jpeg memcached pkg-config siege xvid
@mohnish
mohnish / example.js
Created January 23, 2014 05:49 — forked from tj/example.js
function params(fn) {
var str = fn.toString();
var sig = str.match(/\(([^)]*)\)/)[1];
if (!sig) return [];
return sig.split(', ');
}
console.api = function(obj){
console.log();
var proto = Object.getPrototypeOf(obj);