Skip to content

Instantly share code, notes, and snippets.

View ryansobol's full-sized avatar

Ryan Sobol ryansobol

  • Ryan Sobol LLC
  • Seattle, WA
  • 20:02 (UTC -07:00)
View GitHub Profile
document.getElementById("todo").addEventListener("keypress", function(event) {
if (event.keyCode == 13) {
addToDo();
}
});
function addToDo() {
var newEl = document.createElement("li");
var parentEl = document.getElementById("list");
var firstEl = parentEl.firstChild;

Keybase proof

I hereby claim:

  • I am ryansobol on github.
  • I am ryansobol (https://keybase.io/ryansobol) on keybase.
  • I have a public key whose fingerprint is 796F F213 9A11 4FB9 2921 5DE7 34D6 FF00 1F05 B945

To claim this, I am signing this object:

// Load required module
var http = require('http');
var fs = require('fs');
var url = require('url');
http.createServer(function(request, response) {
var pathname = __dirname + url.parse(request.url).pathname;
fs.exists(pathname, function(exists) {
if (exists) {
@ryansobol
ryansobol / README.md
Last active September 25, 2018 15:14 — forked from IanSmith89/README.md
Galvanize Bookshelf Validations

Server-side Validations for Galvanize Bookshelf

Change into your project directory.

cd galvanize-bookshelf

Ensure the staging area of the master branch is clean. Then, create and checkout a new feature branch.

HTTP/1.1 200 OK
Access-Control-Allow-Credentials: true
Access-Control-Allow-Methods: GET, POST
Access-Control-Allow-Origin: *
Connection: keep-alive
Content-Length: 445
Content-Type: application/json; charset=utf-8
Date: Wed, 05 Jul 2017 04:22:10 GMT
Server: openresty
X-Cache-Key: /data/2.5/weather?APPID=cc4654c8e15f6d08b13954b915a0d0b1&q=seattle
@ryansobol
ryansobol / Array+Permutations.swift
Last active August 12, 2021 15:38
Generate the permutations of a Swift array
extension Array {
func chopped() -> (Element, [Element])? {
guard let x = self.first else { return nil }
return (x, Array(self.suffix(from: 1)))
}
}
print([1, 2, 3].chopped())
// Optional((1, [2, 3]))