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
// Replace with your current LiveReload url | |
var liveReloadUrl = 'http://localhost:35729/livereload.js'; | |
function liveReload(url){ | |
var liveReloadTag = document.createElement('script'); | |
liveReloadTag.type = 'text/javascript'; | |
liveReloadTag.src = url; | |
document.body.appendChild(liveReloadTag); | |
} |
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
var liveReloadUrl = "http://localhost:35729/livereload.js"; | |
var liveReloadTag = '<script type="text/javascript" src="' + liveReloadUrl + '"></script>"'; | |
if(!String.prototype.insertAt){ | |
String.prototype.insertAt = function(index = 0, string = '') { | |
if(index>0) | |
return this.substring(0, index) + string + this.substring(index, this.length); | |
else |
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
var readline = require('readline'); | |
readline.emitKeypressEvents(process.stdin); | |
if (process.stdin.isTTY) | |
process.stdin.setRawMode(true); | |
process.stdin.on('keypress', (chunk, key) => { | |
if (key && key.name == 'q') | |
process.exit(); |
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
let http = require('http'); | |
let fs = require('fs'); | |
function downloadFile(fileUrl, outputFileName) { | |
process.stdout.write(`Downloading: ${fileUrl}\n`); | |
let output = fs.createWriteStream(outputFileName); | |
http.get(fileUrl, (res) => { | |
res.pipe(output); |
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
let imgur = require('imgur'); | |
imgur.setAPIUrl('https://api.imgur.com/3/'); | |
function uploadIt(file) { | |
return imgur.uploadUrl(file); | |
} | |
module.exports.uploadIt = uploadIt; |
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
let fileLink = 'http://.....' // a valid image file link | |
imageUploader.uploadIt(fileLink) | |
.then((jsonResult) => { | |
console.log(`Image link is:\n ${jsonResult.data.link}`); | |
}).catch((err) => { | |
console.log(`Error on uploading image:\n ${err.message}\ntry again later`); | |
}); |
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 API = 'https://api.imgur.com/3/upload'; | |
const CLIENT_ID = `Client-ID xxxxxxxxxxxxxxx`; // Get client-id from imgur: https://api.imgur.com/oauth2/addclient | |
function upload(file) { | |
let data = new FormData(); | |
data.append('image', file); | |
return fetch( | |
API, | |
{ |
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
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8" /> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> | |
<meta http-equiv="X-UA-Compatible" content="ie=edge" /> | |
<script> | |
function calculate() { | |
var run = document.getElementById('run'); | |
run.disabled = true; |
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
<IfModule mod_rewrite.c> | |
<IfModule mod_negotiation.c> | |
Options -MultiViews -Indexes | |
</IfModule> | |
RewriteEngine On | |
# Force to use www just for main domain, not for any subdomain | |
RewriteCond %{HTTP_HOST} ^[^.]+\.[^.]+$ [NC] | |
RewriteRule ^(.*)$ https://www.%{HTTP_HOST}%{REQUEST_URI} [R=301,L,NE] |
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
// Cargo.toml | |
// ----------------------- | |
// [dependencies] | |
// gl = "0.14.0" | |
// [dependencies.sdl2] | |
// version = "0.34.5" | |
// features = ["bundled", "static-link"] | |
use std::thread; |
OlderNewer