var fruits = ['apple', 'orange', 'banana']
var onlyCouscous =
fruits.map
do |fruit| return 'couscous'
console.log onlyCouscous # ["couscous", "couscous", "couscous"]
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CREATE OR REPLACE FUNCTION random_string(length INTEGER) RETURNS TEXT AS $$ | |
DECLARE | |
chars TEXT[] := ARRAY['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9']; | |
result TEXT := ''; | |
i INTEGER; | |
BEGIN | |
FOR i IN 1..length LOOP | |
result := result || chars[1 + RANDOM() * (array_length(chars, 1) - 1)]; | |
END LOOP; | |
RETURN result; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// to avoid using decodeURIComponent(escape(s)) because escape() is not recommended anymore on Ecmascript spec (see MDN). | |
// more info here about this: http://ecmanaut.blogspot.com/2006/07/encoding-decoding-utf8-in-javascript.html | |
function decodeUTF8(utftext) { | |
var string = ""; | |
var i = 0; | |
var c = (c1 = c2 = 0); | |
while (i < utftext.length) { | |
c = utftext.charCodeAt(i); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<meta name="robots" content="noindex"> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<meta name="viewport" content="width=device-width"> | |
<title>Reddit Realtime</title> | |
<link href="https://fonts.googleapis.com/css?family=IBM+Plex+Sans" rel="stylesheet"> | |
<style> |