Skip to content

Instantly share code, notes, and snippets.

/*
*
*
* 0-1-2-5
* | |
* --3
* |
* 4
*/
var div1 = document.getElementById('pad_playlist')
var audioDivs = div1.getElementsByClassName('audio')
for(var i in audioDivs){
var tmpDiv = audioDivs[i];
if(!tmpDiv.getElementsByTagName)
continue;
var inputs = tmpDiv.getElementsByTagName('input');
if(!inputs)
continue;
var url = inputs[0].value;
@dos65
dos65 / EdgeFilterDirection.java
Last active August 29, 2015 14:18
graphopper edgeFilter by azimuth
package com.graphhopper.util;
import com.graphhopper.routing.util.EdgeFilter;
import com.graphhopper.routing.util.FlagEncoder;
import com.graphhopper.storage.NodeAccess;
public class EdgeFilterDirection implements EdgeFilter{
private final double azimuth;
private AngleCalc2D angleCalc = new AngleCalc2D();
@dos65
dos65 / rename.sh
Last active August 29, 2015 14:19
rename xdg user dirs
grep -v '#' ~/.config/user-dirs.dirs | awk '{split($0,a,"="); split(a[1],b,"_");line="$HOME/"substr(b[2],1,1) tolower(substr(b[2],2));print a[1]"=\042"line"\042"}' | tee ~/.config/user-dirs.dirs
package main
import (
"github.com/pkg/sftp"
"golang.org/x/crypto/ssh"
"log"
"io"
)
func main() {
import java.io.File
import com.typesafe.config.{ ConfigFactory, ConfigRenderOptions }
/**
* discovery {
* host = "discovery.global.livetex"
* port = 80
* circuit = "msgtest"
* }
@dos65
dos65 / pBecome.scala
Last active January 18, 2017 00:34
persistent become
case class Message()
class PActor extends PersistentActor with ActorLogging {
override def persistenceId: String = "test"
override def receiveRecover: Receive = recovery(0)
def recovery(count: Int): Receive = {
case RecoveryCompleted =>
import sbt._
import sbt.Keys._
import complete.DefaultParsers._
import ComponentVersionsKeys._
object ComponentVersionsKeys {
lazy val versionFile = settingKey[File]("Version file")
lazy val projectTagName = settingKey[String]("Project name for tag naming")
scala> def showInt(i: Int): String = s"Int: $i"
showInt: (i: Int)String
// Это вообще легально?? replace это метод строки, а не функции
scala> val haha = showInt(_: Int).replace("Int: ", "")
haha: Int => String = <function1>
scala> haha(2)
res20: String = 2
scala> val f = if (_:Boolean) (_:Int) else (_:Int)
f: (Boolean, Int, Int) => Int = <function3>
scala> f(false, 2, 3)
res27: Int = 3
// почему в этом случае 2 аргумента и 2ой функция?
scala> val f2 = if (_:Boolean) (_:Int) + 1 else (_:Int) + 2
f2: Boolean => (Int => Int) = <function1>