Skip to content

Instantly share code, notes, and snippets.

🏠
Working from home

Bobby Johnson NotMyself

View GitHub Profile
View foo.js
function dice() {
}
function rps() {
}
const map = {
'!dice':dice,
'!rps':rps,
};
View foo.cs
public async bool isLive(int twitchId) {
return cache.GetOrAdd(twitchId, () => {
return await service.isLive(twitchId);
});
}
@NotMyself
NotMyself / launch.json
Created Feb 18, 2019
the tasks.json and launch.json from broxburn
View launch.json
{
"version": "0.2.0",
"configurations": [
{
"name": ".NET Core Launch (web)",
"type": "coreclr",
"request": "launch",
"preLaunchTask": "build",
"program": "${workspaceFolder}/api/bin/Debug/netcoreapp2.2/api.dll",
"args": [],
View Dockerfile
FROM microsoft/dotnet:2.2-sdk-alpine AS build
WORKDIR /app
COPY . .
RUN dotnet restore
RUN dotnet build
RUN dotnet publish -c Release -o /app/deploy
FROM microsoft/dotnet:2.2-aspnetcore-runtime-alpine AS runtime
ENV DOTNET_USE_POLLING_FILE_WATCHER=true
View orig-sucker.js
const URLS = [
'https://swapi.co/api/planets/',
'https://swapi.co/api/people/',
'https://swapi.co/api/films/',
'https://swapi.co/api/starships/'
];
async function suckIt(urls) {
let p = []; //unneeded allocation
urls.forEach(u => {//switching to map here returns an array
View winner.js
const Twitter = require('twitter');
/**
* @param context {WebtaskContext}
*/
module.exports = function(context, cb) {
const client = new Twitter({
consumer_key: context.secrets.TWITTER_CONSUMER_KEY,
consumer_secret: context.secrets.TWITTER_CONSUMER_SECRET,
access_token: context.secrets.TWITTER_ACCESS_TOKEN_KEY,
View winner.js
const Twitter = require('twitter');
/**
* @param context {WebtaskContext}
*/
module.exports = function(context, cb) {
const client = new Twitter({
consumer_key: context.secrets.TWITTER_CONSUMER_KEY,
consumer_secret: context.secrets.TWITTER_CONSUMER_SECRET,
access_token: context.secrets.TWITTER_ACCESS_TOKEN_KEY,
View data2.json
{
"employees":[
{
"changedFields":[
"Department",
"Division",
"Job Title",
"Reports To",
"Effective Date"
],
View data.json
{
"employees":[
{
"changedFields":[
"Department",
"Division",
"Job Title",
"Reports To",
"Effective Date",
"Change Reason",
@NotMyself
NotMyself / slash-command.js
Created Apr 9, 2018
Slash Webtask delegating all logic to Webtask.io task.
View slash-command.js
const request = require('request-promise');
function buildEndpoint(context) {
return {
url: context.secrets.QUERY_URL,
method: 'POST',
headers: { 'User-Agent': 'x-webtask' },
auth: {
bearer: context.secrets['wt-auth-secret']
}
You can’t perform that action at this time.