This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
<title>WebSocket demo</title> | |
</head> | |
<body> | |
<div> | |
<form> | |
<label for="numberfield">Number</label> | |
<input type="text" id="numberfield" placeholder="12"/><br /> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"accessors": { | |
"accessors_0": { | |
"bufferView": "bufferViews_3", | |
"byteOffset": 0, | |
"byteStride": 2, | |
"componentType": 5123, | |
"count": 855, | |
"max": [ | |
246 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
selectObject(event) { | |
event.preventDefault(); | |
let vector = new THREE.Vector3( | |
event.clientX / window.innerWidth * 2 - 1, | |
-(event.clientY / window.innerHeight) * 2 + 1, | |
0.5 | |
); | |
vector = vector.unproject(this.camera); | |
const raycaster = new THREE.Raycaster( |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sudo dpkg -i --force-overwrite /var/cache/apt/archives/libgl1-mesa-glx_1%3a17.3~git170828152300.63e79a8~z~padoka0_amd64.deb |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Component extends HTMLElement { | |
constructor() { | |
super(); | |
} | |
connectedCallback() { | |
const height = this.clientHeight, | |
width = this.clientWidth; | |
this.createSvg(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
String.prototype.html = function() { | |
let parser = new DOMParser(); | |
let doc = parser.parseFromString(this, "text/html"); | |
return doc.body.firstChild; | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'.source.js': | |
'Console log': | |
'prefix': 'log' | |
'body': 'console.log($1)', | |
'component': | |
'prefix': 'component' | |
'body': 'class Component extends HTMLElement { connectedCallback() {}} export default Component' | |
'constructor': | |
'prefix': 'const' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const container = document.querySelector(".pell-content"); | |
let selection = window.getSelection(); | |
let range = selection.getRangeAt(0); | |
let dom = HTML`<div id="node"><span style="color:red">${selection.toString()}</span></div>`; | |
selection.deleteFromDocument(); | |
range.insertNode(dom); | |
///Insert first node | |
range.setStartAfter(dom); | |
range.setEndAfter(dom); | |
selection.removeAllRanges(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
server { | |
listen 80; | |
gzip on; | |
gzip_http_version 1.1; | |
gzip_comp_level 3; | |
gzip_proxied any; | |
gzip_types *; | |
source_charset utf-8; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import fs from "fs"; | |
import uuid from "uuid/v1"; | |
const replaceDataImg = (string) => { | |
const data = string.replace(/^data:image\/\w+;base64,/, ""); | |
const buf = new Buffer(data, 'base64'); | |
const name = `server/files/${uuid()}.png`; | |
fs.writeFile(name, buf, (error) => { if(error) console.log("Error!", error)}); | |
return `"${name}"`; | |
} |