Skip to content

Instantly share code, notes, and snippets.

View bilalucar's full-sized avatar
💭
I may be slow to respond.

Bilal Ucar bilalucar

💭
I may be slow to respond.
View GitHub Profile
@bilalucar
bilalucar / JS Keyword Getters And Setters
Created April 17, 2017 16:41
JS Keyword Getters And Setters
var obj = {
fooVal: 'this is the value of foo',
get foo() {
return this.fooVal;
},
set foo(val) {
this.fooVal = val;
}
}
@bilalucar
bilalucar / JS Overwrite prevention
Created April 17, 2017 16:54
JS Overwrite prevention
/* Overwrite prevention */
var obj = {
foo: 'this is the value of foo'
};
Object.defineProperties(obj, {
'getFoo': {
value: function () {
return this.foo;
}
@bilalucar
bilalucar / Operations inside getters and setters
Created April 17, 2017 16:57
Operations inside getters and setters
var obj = {
n: 67,
get id() {
return 'The ID is: ' + this.n;
},
set id(val) {
if (typeof val === 'number')
this.n = val;
}
}
@bilalucar
bilalucar / Creates a new Three.js
Created April 28, 2017 07:12
Creates a new Three.js
const app = new WHS.App([
new WHS.app.ElementModule(), // attach to DOM
new WHS.app.SceneModule(), // creates THREE.Scene instance
new WHS.app.CameraModule(), // creates PerspectiveCamera instance
new WHS.app.RenderingModule() // creates WebGLRenderer instance
]);
app.start(); // run animation
<link rel="stylesheet" href="https://cdn.rawgit.com/tiaanduplessis/wenk/master/dist/wenk.css">
@bilalucar
bilalucar / Wenk tooltips
Created May 3, 2017 07:17
Wenk tooltips
<!-- example of Wenk tooltip appearing on the right -->
<span data-wenk="I'm to the right!" data-wenk-pos="right">
Wenk to the right!
</span>
@bilalucar
bilalucar / AnyChart
Created May 10, 2017 08:38
AnyChart
<div class="table">
<div class="heading">
<div class="cell">
<p>Date</p>
</div>
...
</div>
<div class="row">
<div class="cell">
<p>01/01</p>
@bilalucar
bilalucar / anychart.onDocumentLoad
Created May 10, 2017 08:39
anychart.onDocumentLoad
anychart.onDocumentLoad(function() {
// create a chart and set the data
var chart = anychart.column();
var tableData = anychart.data.parseHtmlTable(
".table", ".row", ".cell p", ".heading .cell p", ".title"
);
chart.data(tableData);
chart.legend(true);
@bilalucar
bilalucar / AnyChart Wordking With JSON Data
Created May 10, 2017 08:40
AnyChart Wordking With JSON Data
anychart.onDocumentReady(function() {
// JSON data
var json = {
"chart": {
"type": "column",
"title": "AnyChart: Data from JSON",
"series": [{
"seriesType": "Spline",
"data": [
{"x": "P1", "value": "128.14"},
@bilalucar
bilalucar / gist:ca26e8ef478352c6feb59b7dec2d0d0c
Created May 10, 2017 08:43
AnyChart Wordking With XML Data
anychart.onDocumentReady(function() {
// XML settings and data
var xml = '<?xml version="1.0" encoding="utf-8"?>' +
'<anychart xmlns="https://cdn.anychart.com/schemas/latest/xml-schema.xsd">' +
'<chart type="polar" container="container">' +
'<series_list>'+
'<series series_type="area">' +
'<data>' +
'<point x="0" value="0"/>'+
'<point x="50" value="100"/>'+