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
var Benchmark = require('benchmark'); | |
Benchmark.prototype.setup = function() { | |
a = ["test"]; | |
for (var i = 0; i < 10000; i++) { | |
a.push("some other stuff"); | |
} | |
s = a.join(); | |
re1 = new RegExp("^test"); | |
re2 = new RegExp("^not there"); | |
}; |
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 path = require('path'); | |
const dot = require(path.resolve(process.argv[2])); | |
const output = { | |
"type": "excalidraw", | |
"version": 2, | |
"source": "https://excalidraw.com", | |
"elements": [], |
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 { Readable } = require('stream'); | |
const express = require('express'); | |
const createCounterReader = (delay) => { | |
let counter = 0; | |
const reader = new Readable({ | |
read() {}, | |
}); | |
setInterval(() => { | |
counter += 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
#!/usr/bin/env node | |
const electronInstaller = require('electron-winstaller'); | |
(async () => { | |
try { | |
const options = JSON.parse(process.env.OPTIONS || process.argv[process.argv.length - 1]); | |
await electronInstaller.createWindowsInstaller(options); | |
} catch (e) { | |
console.error(e); | |
} | |
})(); |
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
var FB = require('fb'); | |
FB.api('oauth/access_token', { | |
client_id: process.env.FACEBOOK_APP_ID, | |
client_secret: process.env.FACEBOOK_SECRET, | |
grant_type: 'client_credentials' | |
}, function(res) { | |
if (!res || res.error) { | |
console.log('error occurred when getting access token:', res && res.error); | |
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
diff --git a/imports/api/tasks.tests.js b/imports/api/tasks.tests.js | |
index 1359e85..9b61c5a 100644 | |
--- a/imports/api/tasks.tests.js | |
+++ b/imports/api/tasks.tests.js | |
@@ -2,6 +2,7 @@ | |
import { Meteor } from 'meteor/meteor'; | |
import { Random } from 'meteor/random'; | |
+import { assert } from 'meteor/practicalmeteor:chai'; | |
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
diff --git a/imports/api/tasks.tests.js b/imports/api/tasks.tests.js | |
index 05287ba..1359e85 100644 | |
--- a/imports/api/tasks.tests.js | |
+++ b/imports/api/tasks.tests.js | |
@@ -1,10 +1,26 @@ | |
/* eslint-env mocha */ | |
import { Meteor } from 'meteor/meteor'; | |
+import { Random } from 'meteor/random'; | |
+ |
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
diff --git a/imports/api/tasks.js b/imports/api/tasks.js | |
index 441feee..9d5b56a 100644 | |
--- a/imports/api/tasks.js | |
+++ b/imports/api/tasks.js | |
@@ -36,12 +36,24 @@ Meteor.methods({ | |
'tasks.remove'(taskId) { | |
check(taskId, String); | |
+ const task = Tasks.findOne(taskId); | |
+ if (task.private && task.owner !== Meteor.userId()) { |
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
diff --git a/imports/api/tasks.js b/imports/api/tasks.js | |
index f1d2c92..441feee 100644 | |
--- a/imports/api/tasks.js | |
+++ b/imports/api/tasks.js | |
@@ -6,8 +6,14 @@ export const Tasks = new Mongo.Collection('tasks'); | |
if (Meteor.isServer) { | |
// This code only runs on the server | |
+ // Only publish tasks that are public or belong to the current user | |
Meteor.publish('tasks', function tasksPublication() { |
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
diff --git a/imports/ui/Task.jsx b/imports/ui/Task.jsx | |
index db0999e..52450c3 100644 | |
--- a/imports/ui/Task.jsx | |
+++ b/imports/ui/Task.jsx | |
@@ -1,5 +1,6 @@ | |
import React, { Component, PropTypes } from 'react'; | |
import { Meteor } from 'meteor/meteor'; | |
+import classnames from 'classnames'; | |
// Task component - represents a single todo item |
NewerOlder