Skip to content

Instantly share code, notes, and snippets.

@stla
stla / animateImage.html
Created February 14, 2014 19:17
my first jQuery test
<!DOCTYPE html>
<html>
<head>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js">
</script>
<script>
$(document).ready(function()
{
$("#btn1").click(function(){
$("#box").animate({width:"300px"});
@stla
stla / ShinyColumnsSelector.R
Last active August 29, 2015 13:56
Shiiny: two selectInput with mutual exclusion
library(shiny)
runApp(
list(ui=pageWithSidebar(
headerPanel("Column Selector - first idea"),
sidebarPanel(
uiOutput("dyncolumns")
),
mainPanel(
tableOutput("subset"),
@stla
stla / JLF.html
Last active August 29, 2015 13:56
Jean-Luc
<!DOCTYPE html>
<html>
<head>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js">
</script>
<script>
$(document).ready(function()
{
$("#btn1").click(function(){
$("#box").animate({width:"200px"});
@stla
stla / server.R
Created May 10, 2014 20:30 — forked from withr/server.R
shinyServer(function(input, output) {
datasetInput <- reactive({
switch(input$dataset,
"rock" = rock,
"pressure" = pressure,
"cars" = cars)
})
output$caption <- renderText({
@stla
stla / kantorovich_v00.scala
Created June 9, 2014 15:40
kantorovich with scala - v00
import breeze.optimize.linear._
object Main {
def main(args: Array[String]) {
println("\nWelcome.\nOpen the console and type e.g. new kantorovich(Array(1.0/7, 2.0/7, 4.0/7), Array(1.0/4, 1.0/4, 1.0/2)).run()\n")
}
}
@stla
stla / RgfiJgfi01.html
Created July 13, 2014 19:02
Comparison Rgfi/Jgfi - 01
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta charset="utf-8">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="Content-Style-Type" content="text/css" />
<meta name="generator" content="pandoc" />
@stla
stla / tofEmilie.html
Last active August 29, 2015 14:04
Emilie JS
<!DOCTYPE html>
<html>
<head>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<link rel="stylesheet" href="//ajax.googleapis.com/ajax/libs/jqueryui/1.11.0/themes/smoothness/jquery-ui.css" />
<script src="//ajax.googleapis.com/ajax/libs/jqueryui/1.11.0/jquery-ui.min.js"></script>
<script>
$(document).ready(function()
{
var root_pieces = 2;
@stla
stla / d3graph.html
Last active August 29, 2015 14:07
temp
<!DOCTYPE html>
<meta charset="utf-8">
<body>
<style>
.link {
stroke: #666;
opacity: 0.6;
stroke-width: 1.5px;
}
.node circle {
```{r}
# group source lines into complete expressions (using a brutal-force method)
group_src_V8 = function(code, context) {
if ((n <- length(code)) < 1) return(list(code))
i = i1 = i2 = 1
x = list()
while (i2 <= n) {
piece = code[i1:i2]
if (eval(parse(text=sprintf("%s$validate(piece)", context))) && eval(parse(text=sprintf('%s$eval(piece)!="undefined"', context)))) {
x[[i]] = piece; i = i + 1
@stla
stla / knitr-V8_v00.Rmd
Created June 21, 2015 16:22
Javascript V8 engine in knitr - output at https://rpubs.com/stla/79457
```{r}
# group source lines into complete expressions (using a brutal-force method)
group_src_V8 = function(code, context) {
if ((n <- length(code)) < 1) return(list(code))
i = i1 = i2 = 1
x = list()
while (i2 <= n) {
piece = code[i1:i2]
if (eval(parse(text=sprintf("%s$validate(piece)", context))) && eval(parse(text=sprintf('%s$eval(piece)!="undefined"', context)))) {
x[[i]] = piece; i = i + 1