View slack_button.js
'/slack': (req, res) => {
if (req.query.code !== void 0) {
let form = new FormData();
form.append('code', req.query.code);
form.append('client_id', config.slack.client_id);
form.append('client_secret', config.slack.client_secret);
fetch('https://slack.com/api/oauth.access', {method: 'POST', body: form, headers: form.getHeaders()}).then(res => res.json()).then(data => {
if (data.ok) {
View curry.js
function curry (fn, ...x) {
const lfn = fn.apply(fn, x);
return function (...y) {
return lfn.apply(lfn, y);
};
}
View script.sh
// run from an administrator powershell
npm install --global --production windows-build-tools
View .eslintrc
{
"env": {
"browser": true,
"node": true,
"es6": true,
"amd": false
},
"ecmaFeatures": {
"jsx": true,
"superInFunctions": false,
View example.js
// imagine there's tab controllers & routes
angular.module('app', ['ionic', 'controllers']).run($rootScope => {
// Override the ionic function 'cause really the state stack is overly complex for what the browser already does
$rootScope.$ionicGoBack = () => {
window.history.back();
};
}).module('controllers', []).controller('AboutCtrl', $scope => {
// Secret sauce for forcing the button to render on a tab where it wouldn't normally render
$scope.$on('$ionicView.beforeEnter', (event, viewData) => {
viewData.enableBack = true;
View test.js
'use strict';
const Application = require('spectron').Application,
path = require('path'),
fs = require('fs'),
mkdirp = require('mkdirp'),
app = new Application(require(path.join(__dirname, 'modules', 'defaults.js'))),
folder = path.join(__dirname, 'tests'),
screenshots = path.join(__dirname, 'screenshots'),
js = /\.js$/,
View bin2dec.js
function bin2dec (arg) {
let output = 0;
arg.split("").reverse().forEach((i, idx) => {
let v = Number(i);
if (v > 0) {
output += idx > 0 ? Math.pow(2, idx) : 1;
}
});
View index.html
<!doctype html>
<html>
<head>
<title>vertical alignment</title>
<style>
html, body {
min-height: 100%;
margin: 0;
}
View example.js
// index.js
var cp = require('child_process'),
n = cp.fork(__dirname + '/sub.js'),
precise = require('precise'),
timer = precise();
n.on('message', function(m) {
timer.stop();
console.log('PARENT got message:', m);
console.log('Message received in', timer.diff() / 1000000, 'ms');
View gist:c8b2ee69480ee778b15d
[Fatal] ConsoleApp: EPIC FAIL!
NzbDrone.Core.Configuration.InvalidConfigFileException: C:\ProgramData\NzbDrone\config.xml is invalid, please see the ht
tp://wiki.sonarr.tv for steps to resolve this issue. ---> System.Xml.XmlException: '.', hexadecimal value 0x00, is an in
valid character. Line 1, position 1.
at System.Xml.XmlTextReaderImpl.Throw(Exception e)
at System.Xml.XmlTextReaderImpl.Throw(String res, String[] args)
at System.Xml.XmlTextReaderImpl.ThrowInvalidChar(Char[] data, Int32 length, Int32 invCharPos)
at System.Xml.XmlTextReaderImpl.ParseRootLevelWhitespace()
at System.Xml.XmlTextReaderImpl.ParseDocumentContent()