Skip to content

Instantly share code, notes, and snippets.

View sgnl's full-sized avatar
🍪
Do you agree to share your cookies?

Ray Farias sgnl

🍪
Do you agree to share your cookies?
  • Honolulu, Hawaii
View GitHub Profile
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>JS Bin</title>
</head>
<body>
<script id="jsbin-javascript">
var groceryStore = {

Red Green Blue

Exercise with Media Queries

Create a standard html5 setup linking an external stylesheet.

index.html
stylesheets/
 styles.css
@sgnl
sgnl / gist:6aa3b188bbabc8c845dd
Last active October 17, 2015 21:10
functional RPS? for the lulz
function init(user, computer){
if (user === computer) {
return {
playerChoice: user,
computerChoice: computer,
text: "It's a TIE"
};
}
if (user === "r" && computer === "s" || user === "p" && computer === "r" || user === "s" && computer === "p") {
@sgnl
sgnl / gist:79b05d5946019db13429
Last active August 29, 2015 14:17
Recursion
/**
* This function logs to the console each element in an Array of Strings.
* This function accepts an Array of Strings as an argument and returns nothing.
*
* printArray(['Such', 'Hawks', 'Such', 'Hounds']);
*
* Will display in the console as:
* Such
* Hawks
* Such

Rock Paper Fireball

The Game

Rock paper fireball is a classic 2 player game.
Each player chooses either rock, paper or fireball.
The possible outcomes:

  • Rock blocks fireball.
  • Fireball engulfs paper.
  • Paper covers rock.
Description:
A bookseller has lots of books classified in 26 categories labeled A, B, ... Z. Each book has a code c of 3, 4, 5 or more capitals letters. The 1st letter of a code is the capital letter of the book category. In the bookseller's stocklist each code c is followed by a space and by a positive integer n (int n >= 0) which indicates the quantity of books of this code in stock.
In a given stocklist all codes have the same length and all numbers have their own same length (can be different from the code length).
For example an extract of one of the stocklists could be:
L = ["ABART 20", "CDXEF 50", "BKWRK 25", "BTSQZ 89", "DRTYM 60"].
@sgnl
sgnl / keybase.md
Created May 27, 2015 00:46
keybase.md

Keybase proof

I hereby claim:

  • I am sgnl on github.
  • I am sgnl (https://keybase.io/sgnl) on keybase.
  • I have a public key whose fingerprint is 21FD 1D94 7C20 9219 92F1 C6BC 7CD8 44D2 B2FC 18F0

To claim this, I am signing this object:

@sgnl
sgnl / app.js
Last active August 29, 2015 14:22
//app.js
var config = require('./config.json');
var express = require('express');
var app = express();
app.use(express.static('public'));
app.get('/', function (request, response) {
response.send('Hello, World!');
});
@sgnl
sgnl / Ruh-Roh.md
Last active August 29, 2015 14:22 — forked from jaywon/Ruh-Roh.md

###Email Hell

We just found out that there is a bug in production that our e-mail function was iterating errantly and sending duplicate e-mails to many users. We need to fix this quickly but we don't want to send out a mass apology letter to all of our users.

Our sysadmin gave us the SMTP logs and we need to process the logs and identify which users received multiple e-mails so that we can directly send them a follow up e-mail explaining the situation and offer super cool swag to keep them on as customers.

Also, the boss wants this done ASAP, we don't have time to do this manually...HAAALLLLPPP!

###The Fix

@sgnl
sgnl / serverCodes.md
Last active June 24, 2023 07:07
status codes

1xx: Information

Code Message Description
100 Continue The server has received the request headers, and the client should proceed to send the request body
101 Switching Protocols The requester has asked the server to switch protocols
103 Checkpoint Used in the resumable requests proposal to resume aborted PUT or POST requests

2xx: Successful

Code Message Description