Skip to content

Instantly share code, notes, and snippets.

@tobiaswright
tobiaswright / index.js
Created October 6, 2024 19:04
This is a script intended for Todoist users. This creates a new task from a completed task based on label.
const labelTarget = "respawn";
const apiKey = "<YOUR OWN API KEY>";
async function todoistReq(url, requestOptions={}) {
let opts = {
method: "GET",
headers: {
"Authorization": "Bearer "+ apiKey,
"Content-Type": "application/json"
}
@tobiaswright
tobiaswright / gist:3690114d574db3baa2b37b6f4626d16d
Created January 11, 2022 15:22
Correct git line ending issues on machine
git config core.autocrlf true
var e = [
{ skill: 'css', user: 'Bill' },
{ skill: 'javascript', user: 'Chad' },
{ skill: 'javascript', user: 'Bill' },
{ skill: 'css', user: 'Sue' },
{ skill: 'javascript', user: 'Sue' },
{ skill: 'html', user: 'Sue' }
];
@tobiaswright
tobiaswright / azureFunction
Last active October 20, 2017 02:17
Getting Locally run Azure Functions going with Azure CosmosDB Emulator
module.exports = function (context, req) {
req.query.tags = JSON.parse(req.query.tags)
context.bindings.outputDocument = req.query
context.done();
};
@tobiaswright
tobiaswright / gist:1be0723582413b5b42cbbe989c6df772
Created August 17, 2017 20:17
JS to grab the Medium feed
const placefeed = (data) => {
const medium = document.getElementById('medium');
data.forEach(function(i) {
let li = document.createElement('li');
li.innerHTML = `<h3><a target=_blank href="${i.primaryLink}>">${i.title}</a></h3><div class='text-muted'>${i.publishDate}</div>`;
medium.appendChild( li )
});
}
@tobiaswright
tobiaswright / gist:a8ba4cc0621c51c5fb3c7131c6495cb1
Created August 17, 2017 20:15
Azure function to retrieve Medium post
module.exports = function (context, req, rss) {
if (rss) {
context.res = {
// status: 200, /* Defaults to 200 */
body: rss
};
}
else {
context.res = {
body: "Sorry, no medium post :("
@tobiaswright
tobiaswright / gist:f02cfbe181e8505f4295acabed8c3525
Created August 17, 2017 20:14
Logic app code to grab a Medium RSS feed
{
"$connections": {...},
"definition": {
"$schema": "https://schema.management.azure.com/providers/Microsoft.Logic/schemas/2016-06-01/workflowdefinition.json#",
"actions": {
"Compose": {
"inputs": "@body('List_all_RSS_feed_items')",
"runAfter": {
"List_all_RSS_feed_items": [
"Succeeded"
"use strict";
const request = require('request');
const crypto = require('crypto');
const publicKey = process.env["PUB_KEY"];
const privateKey = process.env["PRI_KEY"];
const url = "https://gateway.marvel.com/v1/public/";
@tobiaswright
tobiaswright / change permissions
Last active December 23, 2015 22:19
Changing permissions via command line
//source: http://stackoverflow.com/questions/9133024/www-data-permissions
//changes owner and group
sudo chown -R yourname:www-data *folder*
//adds s attribute which will keep new files and directories within *folder* having the same group permissions
sudo chmod -R g+s cake *folder*
@tobiaswright
tobiaswright / ajax as a function
Created July 19, 2013 19:15
Three ways to make ajax callbacks with jQuery
var myCall = function ( callback ) {
$.ajax({
url: url,
data: data,
success: callback,
dataType: dataType
});
};
var myFunction = function( data ) {