Skip to content

Instantly share code, notes, and snippets.

View jalcine's full-sized avatar
💭
Decentralize and democratize the Web.

Jacky Alciné jalcine

💭
Decentralize and democratize the Web.
View GitHub Profile
@jalcine
jalcine / HTTP_API.markdown
Last active August 29, 2015 14:13
A bunch of ideas for using HTTP as a API platform.

Leveraging HTTP as a Basis for Interacting with APIs

Unauthenticated Requests

Using [Last.fm's API][lastfm] as an example; let's wrap this call http://www.last.fm/api/show/user.getRecentTracks.

HTTP: http://www.last.fm/api/show/user.getRecentTracks
HTTP/API: lastfm://user/jackyalcine/currentTracks?size=5
@jalcine
jalcine / foo.rb
Last active August 29, 2015 14:13
# Reverse letters in string.
def reverse_abstract(list)
max_distance = (list.length - 1 / 2)
for i in 0..max_distance do
left_index = i
right_index = list.length - i - 1
left_entry = list[left_index]
right_entry = list[right_index]
@jalcine
jalcine / SECURITY.md
Last active August 29, 2015 14:16 — forked from Najaf/SECURITY.md

Security inspections

At the beginning of each month, we carry out a brief, high-level security inspection. The purpose is to be a sanity check for head-slapping, trivial vulnerabilities that no one expected would be in the code but somehow managed to creep in anyway.

Who's responsible?

One of @alice, @bob or @charlie should do the inspection if no one else has the time.

How often?

#define _CRT_SECURE_NO_WARNINGS // turn off SAFE COMMANDS
// ############################
// Written By: Cristian Colocho
// Date Written: March, 14, 2015
// Purpose: Loop Menu and Switch
// ############################
#include <stdio.h>
#include <stdlib.h>
#define PAUSE system("pause");

#Ruby Interview Questions

What are blocks for?

Plain old english: Ways of grouping code we want to run. The simplest explanation for a block is that it is a chunk of code between {} or do...end, that can't be stored in a variable and isn't an object. A block is just part of the syntax of a method call. It doesn’t mean anything on a standalone basis and can only appear in argument lists.

What are the difference between p and puts?

The difference is subtle, but p prints the true value of an object, rather than a string-ified version of the object. This will make more sense soon, but for the sake of simplicity, we'll use the p command throughout the exercises, as we'll want to see the true values of our code returned to the output window.

effective. Power لُلُصّبُلُلصّبُررً ॣ ॣh ॣ ॣ 冗
function contractingRateInfo( options ) {
var
committed_days,
committed_days_cost,
committed_hours,
committed_hours_cost,
hourly,
weekly
;
Verifying I am +jacky on my passcard. https://onename.com/jacky
ruby <<< EOF
require 'socket'
server_thread = Thread.start do
loop do
print 'foo'
end
end
EOF
@jalcine
jalcine / gist:f58b19ca73a4bcc074d0
Last active August 29, 2015 14:28
Walmart Mobile node.js Setup

Overview

We run multiple server processes in two data centers. Each process listens on two ports, one for HTTP and one for HTTPS. HTTPS is terminated by Apache prior to reaching node.js. HTTP goes directly from the client to node.js (through a master load balancer). We do not use clusters. We slice our physical servers into thin virtual machines running SmartOS, each with about 3GB of memory designed for a single node.js process.

Our node.js servers are hapi.js servers using the composer functionality and plugins architecture. We have three sets of plugins loaded: mobile web front end experience (single page app), legacy API reverse proxy, and monitoring.

We also serve original node.js services off another server zone which runs closed source plugins using hapi.

Analytics