Skip to content

Instantly share code, notes, and snippets.

View alun's full-sized avatar

Alex Lunacharskii alun

View GitHub Profile
(defproject bug-proof "1.0.0-SNAPSHOT"
:description "Figwheel can't be used with resource"
:plugins [[lein-figwheel "0.3.7"]
[lein-resource "14.10.2"]]
:resource {:resource-paths ["pages"]
:target-path "release"
:skip-stencil [#".*"]})
(fn find-latins
[vectors]
(let [height (count vectors)
width (->> vectors (map count) (apply max))
spaces (for [line vectors]
(-> (- width (count line))
inc
range))
alignments (reduce #(for [cur % up %2]
(conj cur up))
@alun
alun / showtime.coffee
Created August 26, 2014 07:55
Script timings
try
Array::sum = ->
sum = 0
for x in @
sum += x
sum
now = -> new Date().getTime()
time = (f, takes = 100000) ->
@alun
alun / gist:8052391
Last active December 31, 2015 22:19
{
"bid": {
"id": "5142f2dae4b0a3bd1f93bf91",
"videos": [{
"videoId": "5134b0d6e4b08b2859636545",
"name": "Masha's video 222",
"videoUrls": ["http://cdn.vidible.tv/stage/2013-06/17/5134b0d6e4b08b2859636545_300x250_v5.mp4?bid=5142f2dae4b0a3bd1f93bf91&pid=52270e6ee4b023e3657c51b6&bcid=50e403a2c1321e0931a07af4&vid=5134b0d6e4b08b2859636545"],
"fullsizeThumbnail": "http://cdn.vidible.tv/stage/2013-10/17/5134b0d6e4b08b2859636545_o_U_v8.jpg?bid=5142f2dae4b0a3bd1f93bf91&pid=52270e6ee4b023e3657c51b6&bcid=50e403a2c1321e0931a07af4&vid=5134b0d6e4b08b2859636545"
}]
},
@alun
alun / script.coffee
Last active December 27, 2015 18:19
Put decoded flash vars of the first object onto the console
objects = document.getElementsByTagName "object"
for param in objects[0].childNodes
flashvars = param.value if param.name == "flashvars"
for kv in flashvars.split("&")
[name, value] = kv.split("=")
console.log(decodeURIComponent(name), decodeURIComponent(value))
@alun
alun / MyBanner.as
Last active December 18, 2015 17:49
The demo case how to wait until all images are loaded
package {
import com.oggi.Utilities.events.Synchronizer;
import com.oggi.Utilities.ui.DisplayList;
import com.oggi.ui.controls.Image;
import com.oggi.unit.Banner;
import flash.display.DisplayObject;
import flash.events.Event;
public class MyBanner extends Banner {
{
"id": "51a8fc0ae4b091530c2bccff",
"bid": {
"id": "51a8fb91e4b091530c2bccfe",
"videos": [{
"videoId": "516323e1e4b0b3222821b4c8",
"name": "Fashion Theater",
"description": "Ever wonder what it's like inside the mind of a runway model at Fashion Week? Get a sneak peak at our brand new series, with model Anna Lungard at the Angel Sanchez show at this year's NY Fashion Week, and stay tuned for tons of behind-the-scenes interviews and backstage footage. Coming soon!",
"videoUrl": "http://cdn.vidible.tv/prod/2013-04/08/516323e1e4b0b3222821b4c8_640x360_v1.mp4?bid=51a8fb91e4b091530c2bccfe&pid=51a8fc0ae4b091530c2bccff&vid=516323e1e4b0b3222821b4c8",
"thumbnail": "http://cdn.vidible.tv/prod/2013-04/08/516323e1e4b0b3222821b4c8_l_v1.jpg?bid=51a8fb91e4b091530c2bccfe&pid=51a8fc0ae4b091530c2bccff&vid=516323e1e4b0b3222821b4c8"
@alun
alun / .gitignore
Last active December 17, 2015 21:49
Test for the lift css selectors running from external files
target
.idea*
project/target
@alun
alun / console.xml
Last active December 17, 2015 03:49
My Console2 config
<?xml version="1.0"?>
<settings>
<console change_refresh="10" refresh="100" rows="40" columns="120" buffer_rows="1000" buffer_columns="0" shell="" init_dir="" start_hidden="0" save_size="0">
<colors>
<color id="0" r="238" g="232" b="213"/>
<color id="1" r="38" g="139" b="210"/>
<color id="2" r="133" g="153" b="0"/>
<color id="3" r="42" g="161" b="152"/>
<color id="4" r="220" g="50" b="47"/>
<color id="5" r="211" g="54" b="130"/>
import java.io.{UnsupportedEncodingException, InputStreamReader, IOException}
import java.net.{ProtocolException, MalformedURLException, HttpURLConnection, URL}
import util.control.Exception._
object URLPrinter extends App {
val defaultEncoding = "CP1251"
val targetURL = "http://google.com"
var readerOpt = Option.empty[InputStreamReader]
val catchingErrors = Seq(