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
LABELS=( | |
{ | |
'attributes': { | |
'type': 'rect', | |
'class':'rect' | |
}, | |
'inserter': 'sloth.items.RectItemInserter', | |
'item': 'sloth.items.RectItem', | |
'hotkey': 'r', | |
'text': 'Rectangle', |
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
git clone --bare git@github.com:ZaninAndrea/config.git $HOME/.cfg | |
function config { | |
/usr/bin/git --git-dir=$HOME/.cfg/ --work-tree=$HOME $@ | |
} | |
mkdir -p .config-backup | |
config checkout | |
if [ $? = 0 ]; then | |
echo "Checked out config."; | |
else | |
echo "Backing up pre-existing dot files."; |
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 request = require("request") | |
const cheerio = require("cheerio") | |
const url = "http://foo.bar" | |
const findTitleInDom = ($dom) => { | |
return $dom.find("meta[property='og:title']").attr("content") || | |
$dom.find("title").text() || | |
$dom.find("meta[name=title]").attr("content"); | |
} |
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 buildTree = (list, parent) => { | |
var node = {} | |
list | |
.filter(x => x.parent === parent) | |
.forEach(x => { | |
node[x.id] = buildTree(list, x.id) | |
}) | |
return node | |
} | |
// { autofold |
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 {app, BrowserWindow, ipcMain} = require('electron'); | |
const {autoUpdater} = require("electron-updater"); | |
let win; // this will store the window object | |
// creates the default window | |
function createDefaultWindow() { | |
win = new BrowserWindow({width: 900, height: 680}); | |
win.loadURL(`file://${__dirname}/index.html`); | |
win.on('closed', () => app.quit()); | |
return win; |
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
appId: your.App.Id | |
publish: | |
provider: github | |
token: $$YOURTOKEN$$ |
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
{ | |
"repository": "https://github.com/UserName/RepoName", | |
"scripts": { | |
"build": "build --win", | |
"ship": "build --win -p always" | |
} | |
} |
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>Electron AutoUpdater</title> | |
</head> | |
<body> | |
<script> | |
const ipcRenderer = require('electron').ipcRenderer; |
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
// init project | |
const express = require('express'); // the library we will use to handle requests | |
const app = express(); // instantiate express | |
app.use(require("cors")()) // allow Cross-domain requests | |
app.use(require('body-parser').json()) // automatically parses request data to JSON | |
// base route | |
app.get("/", function (request, response) { | |
response.send("TODO") // always responds with the string "TODO" | |
}); |
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 fuzzyScore = (input, correct) => { | |
let score = 0 | |
let lastId = 0 | |
for(id in input) { | |
while(input[id] !== correct[lastId] && lastId < correct.length){ | |
lastId++ | |
score++ | |
} | |
lastId++ |
OlderNewer