Skip to content

Instantly share code, notes, and snippets.

View philard's full-sized avatar

Philip Ardley philard

  • EPAM
  • Shenzhen
View GitHub Profile
@philard
philard / index.html
Created January 23, 2018 08:49
Graphlayout example for mxGraph Graphlayout example for mxGraph // source http://jsbin.com/neqoqul
<!--
Copyright (c) 2006-2013, JGraph Ltd
Graphlayout example for mxGraph. This example demonstrates using
automatic graph layouts and listening to changes of the graph size
to keep the container size in sync.
-->
<html>
<head>
<meta name="description" content="Graphlayout example for mxGraph">
String className = (this != null) ? this.getClass().getSimpleName() : "";
int wavFilesCount = new java.io.File("sounds").listFiles().length;
int clipIndex = (className.hashCode() & 0x7FFFFFFF) % wavFilesCount;
javax.sound.sampled.Clip clip = javax.sound.sampled.AudioSystem.getClip();
java.io.File wavFile = new java.io.File("sounds" + java.io.File.separator + "sound" + clipIndex + ".wav");
javax.sound.sampled.AudioInputStream audio = javax.sound.sampled.AudioSystem.getAudioInputStream(wavFile);
clip.open(audio);
clip.start();
@philard
philard / Unit 1.py
Last active December 17, 2015 18:19
Unit 1
i=1
t='e'
s='hi there'
print(s.find(t,i))
print(s[i:].find(t))
print(s[i:].find(t)+i)
# Write Python code that initializes the variable
@philard
philard / Untitled 1.py
Created May 26, 2013 08:00
Untitled 1
i=1
t='e'
s='hi there'
print(s.find(t,i))
print(s[i:].find(t))
print(s[i:].find(t)+i)