This file contains hidden or 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
| extern crate rand; | |
| use rand::prelude::*; | |
| use std::collections::HashMap; | |
| use std::io::{stdin, stdout, Write}; | |
| fn main() { | |
| let mut game_values: HashMap<&str, i32> = HashMap::new(); | |
| game_values.insert("kivi", 1); |
This file contains hidden or 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
| use svg <svg class="twitter-icon"> | |
| <use xlink:href="path/to/icons.svg#twitter-icon"></use> | |
| <svg> |
This file contains hidden or 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 apt-get install postgresql-server-dev-all | |
| sudo apt-get install postgresql-common |
This file contains hidden or 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 { HTML } from "/modules/light-html/index.js"; | |
| class Component extends HTMLElement { | |
| constructor() { | |
| super(); | |
| this.hide = this.hide.bind(this); | |
| } | |
| hide() { | |
| this.style.display = "none"; |
This file contains hidden or 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 csvToJson = csv => { | |
| const response = []; | |
| const allLines = csv.split(/\r\n|\n/); | |
| const headers = allLines[0].split(/\t|,/).filter(value => value); | |
| for (let item = 1; item < allLines.length; item++) { | |
| const data = {}; | |
| const lineData = allLines[item].split(/\t|,/).filter(value => value); | |
| if (lineData.length == headers.length) | |
| lineData.forEach((line, index) => { | |
| data[headers[index]] = line; |
This file contains hidden or 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
| addStyle(sheet, location) { | |
| const style = document.createElement("style"); | |
| style.type = `text/css`; | |
| style.appendChild(document.createTextNode(sheet)); | |
| location.appendChild(style); | |
| } | |
This file contains hidden or 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}"`; | |
| } |
This file contains hidden or 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 hidden or 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 hidden or 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' |