Skip to content

Instantly share code, notes, and snippets.

View inadarei's full-sized avatar

Irakli Nadareishvili inadarei

View GitHub Profile
@inadarei
inadarei / private-property.js
Last active August 29, 2015 14:06
Hiding Javascript Object's value from JSON.stringify
function Data() {
var privProp = 5;
this.name = "some data object";
Object.defineProperty(this, 'getPropPublic', {
get: function() { return privProp; }
});
}
@inadarei
inadarei / openss-osx-install.md
Last active August 29, 2015 13:56
OpenSSL installation with native OS-X PHP
$  wget http://www.php.net/get/php-5.3.28.tar.gz/from/this/mirror
$  mv mirror php.5.3.28.tar.gz
$ tar xzvf php.5.3.28.tar.gz
$ cd php-5.3.28/
$ ./configure --with-openssl=shared
$ make
$ export OPENSSL_EXT_DIR=/usr/local/Cellar/php53-openssl # can be anything really as far as it matches value in the .ini file, later
$ mkdir $OPENSSL_EXT_DIR
$ cp modules/openssl.so $OPENSSL_EXT_DIR
@inadarei
inadarei / copyright.md
Last active January 1, 2016 13:09
Sandra Day O'Connor On Copyright
@inadarei
inadarei / view.md
Last active December 31, 2015 09:59 — forked from mstade/view.md
/foo should be requested as Javascript. Most probably just a typo in the original.

Application views using HTTP trickery

If the client makes a request, let's say this is an initial request to a resource that the client knows nothing about. It goes along and does a little something like this:

GET /foo HTTP/1.1
Accept: text/html
@inadarei
inadarei / osxstartup.md
Last active December 26, 2015 13:49
Ways something can start on OS-X
  1. System Preferences -> {Account} -> Login Items
  2. ~/Library/LaunchAgents
  3. /System/Library/LaunchAgents
  4. /System/Library/LaunchDaemons
  5. ~/.profile or ~/.bash_profile
@inadarei
inadarei / testrequest.js
Created August 1, 2013 20:27
Node.js compounding http request latency problem
/**
Some relevant links along the way:
https://github.com/joyent/node/issues/2809
https://github.com/joyent/node/issues/877
**/
var http = require('http');
Pragma: akamai-x-cache-on, akamai-x-cache-remote-on, akamai-x-check-cacheable, akamai-x-get-cache-key, akamai-x-get-extracted-values, akamai-x-get-nonces, akamai-x-get-ssl-client-session-id, akamai-x-get-true-cache-key, akamai-x-serial-no
@inadarei
inadarei / json-example.js
Created June 4, 2013 22:20
JSON Example
{
"glossary": {
"title": "example glossary",
"GlossDiv": {
"title": "S",
"GlossList": {
"GlossEntry": {
"ID": "SGML",
"SortAs": "SGML",
"GlossTerm": "Standard Generalized Markup Language",
@inadarei
inadarei / base64.js
Created January 6, 2013 04:11
base64 encode/decode in Node.js
var url = "http://cdn1.giltcdn.com/images/share/uploads/0000/0001/7250/172502872/420x560.jpg";
var encoded = new Buffer(url).toString('base64');
var decoded = new Buffer(encoded, 'base64').toString('ascii')
console.log(encoded);
console.log(decoded);
def disable_notifications!
auth_url = "https://twitter.com/login"
notifications_url = "https://twitter.com/settings/notifications"
agent = Mechanize.new
page = agent.get(auth_url)
puts "DISABLING NOTIFICATIONS for #{self.username}"
puts "Logging in..."
page.forms_with(:action => 'https://twitter.com/sessions') do |forms|