Skip to content

Instantly share code, notes, and snippets.

View yonicd's full-sized avatar

yonicd

View GitHub Profile
@yonicd
yonicd / console_in_widget.R
Last active June 5, 2017 01:53
show active console with log, warnings and errors during within widget during widget run
library(htmltools)
browsable(
tagList(
tags$pre(id="myPreview"),
tags$script("
var log = document.querySelector('#myPreview');
['log','debug','info','warn','error'].forEach(function (verb) {
console[verb] = (function (method, verb, log) {
return function () {
method.apply(console, arguments);
@yonicd
yonicd / XMLHttpRequest.R
Created June 5, 2017 01:02
testing XMLHttpRequest in windows
library(htmltools)
browsable(
tagList(
tags$pre(id="myPreview"),
tags$script(
'
var uri="https://raw.githubusercontent.com/yonicd/jsTree/master/README.md?raw=true";
loadXMLDoc(uri);
@yonicd
yonicd / jstree_icon2.html
Created June 1, 2017 13:34
jstree icon tag attempt
<div id="htmlwidget-9f0eb65ab1d8850629a1" style="width:960px;height:500px;" class="jsTree html-widget"></div>
<script type="application/json" data-for="htmlwidget-9f0eb65ab1d8850629a1">{"x":{"data":[{"text":"root","children":[{"text":".","children":[{"text":".git","children":[{"text":"branches","icon":"fa fa-file-o","state":[]},{"text":"hooks","icon":"fa fa-file-o","state":[]},{"text":"info","icon":"fa fa-file-o","state":[]},{"text":"logs","children":[{"text":"refs","children":[{"text":"heads","icon":"fa fa-file-o","state":[]},{"text":"remotes","children":[{"text":null,"icon":"fa fa-file-o","state":[]},{"text":"origin","icon":"fa fa-file-o","state":[]}]}]}]},{"text":"objects","children":[{"text":null,"icon":"fa fa-file-o","state":[]},{"text":"01","icon":"fa fa-file-o","state":[]},{"text":"04","icon":"fa fa-file-o","state":[]},{"text":"05","icon":"fa fa-file-o","state":[]},{"text":"06","icon":"fa fa-file-o","state":[]},{"text":"09","icon":"fa fa-file-o","state":[]},{"text":"0c","icon":"fa fa-file-o","state":[]
@yonicd
yonicd / example_jstree_widget.html
Created June 1, 2017 12:18
example jstree widget
This file has been truncated, but you can view the full file.
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<script src="data:application/x-javascript;base64,KGZ1bmN0aW9uKCkgewogIC8vIElmIHdpbmRvdy5IVE1MV2lkZ2V0cyBpcyBhbHJlYWR5IGRlZmluZWQsIHRoZW4gdXNlIGl0OyBvdGhlcndpc2UgY3JlYXRlIGEKICAvLyBuZXcgb2JqZWN0LiBUaGlzIGFsbG93cyBwcmVjZWRpbmcgY29kZSB0byBzZXQgb3B0aW9ucyB0aGF0IGFmZmVjdCB0aGUKICAvLyBpbml0aWFsaXphdGlvbiBwcm9jZXNzICh0aG91Z2ggbm9uZSBjdXJyZW50bHkgZXhpc3QpLgogIHdpbmRvdy5IVE1MV2lkZ2V0cyA9IHdpbmRvdy5IVE1MV2lkZ2V0cyB8fCB7fTsKCiAgLy8gU2VlIGlmIHdlJ3JlIHJ1bm5pbmcgaW4gYSB2aWV3ZXIgcGFuZS4gSWYgbm90LCB3ZSdyZSBpbiBhIHdlYiBicm93c2VyLgogIHZhciB2aWV3ZXJNb2RlID0gd2luZG93LkhUTUxXaWRnZXRzLnZpZXdlck1vZGUgPQogICAgICAvXGJ2aWV3ZXJfcGFuZT0xXGIvLnRlc3Qod2luZG93LmxvY2F0aW9uKTsKCiAgLy8gU2VlIGlmIHdlJ3JlIHJ1bm5pbmcgaW4gU2hpbnkgbW9kZS4gSWYgbm90LCBpdCdzIGEgc3RhdGljIGRvY3VtZW50LgogIC8vIE5vdGUgdGhhdCBzdGF0aWMgd2lkZ2V0cyBjYW4gYXBwZWFyIGluIGJvdGggU2hpbnkgYW5kIHN0YXRpYyBtb2RlcywgYnV0CiAgLy8gb2J2aW91c2x5LCBTaGlueSB3aWRnZXRzIGNhbiBvbmx5IGFwcGVhciBpbiBTaGlueSBhcHBzL2RvY3VtZW50cy4KICB2YXIgc2hpbnlNb2R
@yonicd
yonicd / .block
Created April 1, 2017 00:55
fresh block
license: mit
@yonicd
yonicd / .block
Created April 1, 2017 00:55
fresh block
license: mit
@yonicd
yonicd / .block
Created March 30, 2017 19:03
fresh block
license: mit
@yonicd
yonicd / html2tagList.R
Last active April 3, 2020 07:25
convert raw html to htmltools::tagList
#'@title html2tagList
#'@description convert raw html to htmltools tagList
#'@param x character vector of html
#'@examples
#'
#'x<-'<h1>Title</h1>
#' <h2>Header text</h2>
#' <p>Text here</p>
#' <h1>Title</h1>
#' <h2>Header text</h2>
@yonicd
yonicd / .block
Last active March 9, 2017 12:37
spline editor with animation
license: mit
@yonicd
yonicd / mycode.js
Created July 22, 2016 15:25 — forked from markheckmann/mycode.js
client/server interaction with shiny - part 3 (separate JS file)
// Execute function body when the HTML document is ready
$(document).ready(function() {
// javascript code to send data to shiny server
document.getElementById("mydiv").onclick = function() {
var number = Math.random();
Shiny.onInputChange("mydata", number);
};