View foo.html
<html>
<head>
<script type="text/javascript" src="http://cdn.clappr.io/latest/clappr.min.js"></script>
<script type="text/javascript" src="http://cdn.jsdelivr.net/clappr.rtmp/0.0.2/rtmp.min.js"></script>
</head>
<body>
<div id="player"></div>
<script>
window.onload = function() {
var player = new Clappr.Player({
View index.html
<!DOCTYPE html>
<html>
<head>
<script>
var map = {};
var toggle = true;
keyEvent = function(e) {
map[e.keyCode] = e.type == 'keydown';
if(map[17] && map[65]) {
img = document.getElementById("image");
View summary_tool.py
# coding=UTF-8
from __future__ import division
import re
# This is a naive text summarization algorithm
# Created by Shlomi Babluki
# April, 2013
class SummaryTool(object):
View gist:9b6705eecd1fcb20b97506a6ddb7bb6e
Publisher:
# Persist message in a queue
lpush channel1.queue message
# Publish message to any connected subscriber
publish channel1 message
Subscriber:
# Subscribe to channel1
subscribe channel1
View gist:54becc25abe46ba98c4c7062e81e2845
package main
import (
"encoding/json"
"fmt"
)
func main() {
mapD := map[string]interface{}{"deploy_status": "public", "status": "live", "version": 2}
mapB, _ := json.Marshal(mapD)
View compress.go
import (
"archive/zip"
"io"
"os"
"path/filepath"
"strings"
)
func zipit(source, target string) error {
zipfile, err := os.Create(target)
View round.go
package main
import (
"log"
"math"
)
func Round(val float64, roundOn float64, places int ) (newVal float64) {
var round float64
pow := math.Pow(10, float64(places))
View gist:b21c02139314cf773c8c3f2cbc3e6aab
class A
attr_accessor :a
def initialize
@a = 100
end
def aa
a = 1000
View gist:376c99858c0106b6ebc9dad06c9043a5
f=fs.readdirSync(".")
for(i=0; i<f.length; i++) {fs.renameSync(f[i], f[i].replace(/ |\'/g, "-"))}
View problem
We define to be a permutation of the first natural numbers in the range . Let denote the position of in permutation (please use -based indexing).
is considered to be an absolute permutation if holds true for every .
Given and , print the lexicographically smallest absolute permutation, ; if no absolute permutation exists, print -1.
Input Format
The first line of input contains a single integer, , denoting the number of test cases.
Each of the subsequent lines contains space-separated integers describing the respective and values for a test case.