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
addStyle(sheet, location) { | |
const style = document.createElement("style"); | |
style.type = `text/css`; | |
style.appendChild(document.createTextNode(sheet)); | |
location.appendChild(style); | |
} | |
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 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 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 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 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 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 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
struct Moose { | |
name: String | |
} | |
struct Deer { | |
name: String | |
} | |
trait Actions { | |
fn baby_name(&self) -> String; |
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 emails = "[email protected]" | |
const msg = `<p><span>msg:${req.body.msg}</span> <br /> <span>url:${req.body.url}</span> <br /> <span>line:${req.body.lineNo}</span> <br /> <span>column:${req.body.columnNo}</span> <br /> error:${req.body.error}</p>`; | |
exec.exec(`echo "From:[email protected]\r\nDate: $(date)\r\nSubject:website crash report\r\nMIME-Version: 1.0\r\nContent-Type: text/html; charset=utf-8\r\n\r\n ${msg}" | sudo ssmtp -vvv -C ssmpt2.conf -ap 55604881 -F " Pro error" ${emails}`, (err, stdout, stderr) => { | |
if (err) {return;} | |
}); |
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
### Add security rule for public access | |
service firebase.storage { | |
match /b/{bucket}/o { | |
match /{allPaths=**} { | |
allow read, write; | |
} | |
} | |
} |
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
/* | |
write a function that takes two inputs: | |
vocabulary - array of strings (words) | |
sentence - string | |
and returns: | |
true - if the sentence can be split in the words given; words can be repeated, words can have any order; you can use only subset of words | |
false - if the sentence cannot be split in the words |