short javascript examples
function testJson() {
var aaa = '{"words":{\
"ena": [{"id": "1","loc": "1"},{"id": "2","loc": "2"}],\
"dva": [{"id": "4","loc": "2"},{"id": "7","loc": "3"}]\
}}';
var bbb = JSON.parse(aaa);
#!/bin/bash | |
# | |
# Installs Scala. | |
# Install Scala: | |
SCALA_VERSION="2.11.1"; | |
wget http://downloads.typesafe.com/scala/$SCALA_VERSION/scala-$SCALA_VERSION.tgz | |
tar xvzf scala-$SCALA_VERSION.tgz | |
sudo sh -c 'echo "export SCALA_HOME=\"$PWD/scala-'$SCALA_VERSION'\"" >> /etc/profile; echo "export PATH=\"\$PATH:\$SCALA_HOME/bin\"" >> /etc/profile;' | |
sh /etc/profile |
#!/usr/bin/env bash | |
# | |
# Creates pdf file from source code. | |
tex_file=$(mktemp) ## Random temp file name | |
cat<<EOF >$tex_file ## Print the tex file header | |
\documentclass{article} | |
\usepackage{listings} | |
\usepackage[usenames,dvipsnames]{color} %% Allow color names |
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>Player Movement using onkeydown/onkeyup (Enhanced version)</title> | |
<style type="text/css" media="screen"> | |
canvas { border: 1px solid; } | |
</style> | |
<script type="text/javascript" charset="utf-8"> | |
///////////// |
#!/bin/sh | |
exec scala "$0" "$@" | |
!# | |
import java.io.File | |
import java.awt.image.BufferedImage | |
import javax.imageio.ImageIO | |
import javax.imageio.ImageTypeSpecifier | |
import java.awt.image.DataBufferByte | |
import java.awt.image.DataBufferInt |
#!/usr/bin/python3 | |
# | |
# Usage: spiral.py [MATRIX_HEIGHT] | |
# | |
# Draws spiral of the prime numbers. Numbers are arranged in a spiral like this: | |
# 17 16 15 14 29 | |
# 18 5 4 3 28 | |
# 19 6 1 2 27 | |
# 20 7 8 9 26 | |
# 21 22 23 24 25 |
#!/usr/bin/env python3 | |
# | |
# Usage: pub.py [NUM] | |
# Tries to solve the problem of: | |
# 1 1 1 = 6 | |
# 2 2 2 = 6 | |
# 3 3 3 = 6 | |
# ... | |
import sys |
#!/usr/bin/python3 | |
# | |
# Usage: man.py | |
# | |
import numpy as np | |
import sys | |
ASCII_GREYSCALE = " .:-=+*#%@" |
<html> | |
<head> | |
<script src="d3.v3.min.js" charset="utf-8"></script> | |
<style> | |
.bkgrnd { | |
fill-opacity: 0.5 | |
} | |
.temp-text { | |
font-family: Arial, sans-serif; | |
} |