obj = (function() {
currentValue = 7
return {
valueOf: function() { return currentValue = currentValue+2 }
}
})()
(obj < 10) && (obj > 10) //true
/ invalid | |
%div | |
%span | |
%span | |
%span{ | | |
"foo" => "bar", | | |
"baz" => 'quz' } | |
/ valid | |
%div |
# all permissions/setup are handled through the google docs interface. basically, this isn’t a DSL for google docs. figure that shit out yourself. | |
# all querying logic happens in ruby. find is provided for simplicity. | |
# no optimizing for speed. this is a google doc db after all. | |
# connections only occur when necessary. no preloading. avoid unncessary connections after first. | |
# configuration must be simple. and preferably self-contained within file. | |
#not tied to language. would be cool to do this as a front-end JS library too. | |
class User < APIModel | |
def self.configure | |
@SPREADSHEET_URL = ‘someurl’ |
The challenge is to write a function that evaluates whether an ordered list of edge characters — parentheses, brackets, or curly braces — is correctly balanced according to the following rules:
-
Each opening character must be eventually followed by its corresponding closing character. (e.g. an opening parenthesis must be followed by a closing parenthesis, but not necessarily immediately.)
-
The characters must be nested correctly, so that each pair of characters maintains a valid scope. (e.g. an opening bracket cannot be immediately followed by a closing curly brace.)
This challenge must be written in JavaScript. For ease of use, I suggest using node.
The challenge is to implement a program called "sample" that outputs a sorted list of random numbers to the console. Your program should be run like this:
ruby sample MEMBERS LIMIT
MEMBERS is the number of results you want the program to output, and LIMIT is the upper limit for the sample range. All results should be greater than or equal to 0 and less than LIMIT. Some examples:
#HTTParty isn't broken! it deals with 304 errors as per RFC 2616, | |
#returning a response with headers but no body. | |
require 'httparty' | |
response = HTTParty.get("https://api.github.com/users/octocat", { | |
:headers => {"User-Agent" => "HTTParty"}, | |
}) | |
etag = response.headers["etag"] |
//JavaScript Promises! They are the next big thing in JavaScript, the coolest thing | |
//you've never heard about in the coolest language out there. And as of last year, | |
//They are supported by new builds of Chrome. It's only a matter of time until | |
//they're supported everywhere. So...what are they? | |
//Well, in essence, a Promise represents an asynchronous task. While the task is | |
//being completed, it is represented by a Promise object, and once completed it | |
//returns the value you expected. They are a tool to handle asynchronous functionality | |
//in JavaScript, as well as make your code more readable, extendable, and better at | |
//handling errors. So what do they look like? Well before we can do that, we need to |
<?php | |
function slowApiLookup() { | |
try { | |
$url = "http://slowapi.com/delay/5.0"; | |
$curlSession = curl_init(); | |
curl_setopt($curlSession, CURLOPT_URL, $url); | |
curl_setopt($curlSession, CURLOPT_RETURNTRANSFER,1); | |
curl_setopt($curlSession, CURLOPT_TIMEOUT,1); | |
$response = curl_exec($curlSession); |
<html> | |
<head> | |
</head> | |
<body> | |
<script src="jquery.js" type=text/javascript></script> | |
<script type=text/javascript> | |
$(document).ready(function() { | |
addKISSmetricsToButtons(); |