Skip to content

Instantly share code, notes, and snippets.

View peterfoxflick's full-sized avatar
🐧
Coding up a storm

Peter Flickinger peterfoxflick

🐧
Coding up a storm
View GitHub Profile
{
"display_information": {
"name": "Round Robin",
"description": "Everyone gets a turn.",
"background_color": "#007e8c"
},
"features": {
"bot_user": {
"display_name": "Round Robin",
"always_online": false
Here is some code
Here is some more
function sendMail() {
var sheet = SpreadsheetApp.getActiveSheet()
var message = "This week there was " + sheet.getRange("B3").getValue() + " Tiktok views, "
message += sheet.getRange("B4").getValue() + " Youtube views, and "
message += sheet.getRange("B4").getValue() + " Skillshare views."
MailApp.sendEmail("boss@gmail.com", "This weeks views", message)
}
@peterfoxflick
peterfoxflick / contentView.swift
Last active November 6, 2020 03:10
Progress view updated by threads in SwiftUI
import SwiftUI
struct ContentView: View {
@State var total = 0
@State var progress = 0
@State private var workItem: DispatchWorkItem?
var body: some View {
@peterfoxflick
peterfoxflick / socailDist.ino
Last active April 19, 2020 15:57
ATTINY Social Distancing
/*
* Original Ultrasonic code by Rui Santos, https://randomnerdtutorials.com
* Modified by Peter Fox Flick for attiny, peterfoxflick.com
* VIDEO: https://youtu.be/dF5E5jsWSZA
Ultrasonic sensor Pins:
VCC: +5VDC
Trig : Trigger (INPUT) - Pin 0
Echo: Echo (OUTPUT) - Pin 1
var key = "xxxxx"; // for trello
var token = "xxxxx"; // for trello
function main() {
//First get all homework assignments
var homework = UrlFetchApp.fetch('https://byui.instructure.com/api/v1/users/self/upcoming_events?access_token=xxxxxx');
homework = JSON.parse(homework);
//Now create cards for each one
homework.forEach(createCard);
}
require 'benchmark'
%x(rm output.csv)
file = File.open('output.csv', 'a')
file.puts("N,DoWhile,ForEach,ForOf,ForLoop,While")
file.close
10000.times{ |i|
file = File.open('output.csv', 'a')
@peterfoxflick
peterfoxflick / removeFiles.js
Created May 16, 2019 21:16
If you need a simple way to remove files from a cluttered folder in canvas this should help do the trick. It only works in chunks of 100. Run with node.js
var Request = require("request");
const folderID = "XXXX"
const access_token = "XXXXXXXXXX"
delete100()
//Get all the files in a given folder ID and remove them.
function delete100(){
var url = "https://byui.instructure.com/api/v1/folders/" + folderID + "/files?access_token=" + access_token + "&per_page=100"
@peterfoxflick
peterfoxflick / code.gs
Created February 26, 2019 00:33
Hidden Row Data: A simple Google Add-on that shows the meta data you save to a row in Google Sheets.
function onOpen() {
var ui = SpreadsheetApp.getUi();
ui.createMenu('Hidden Row Data')
.addItem('Show Data', 'showSidebar')
.addToUi();
}
function showSidebar() {
var html = HtmlService.createTemplateFromFile('sidebar');
@peterfoxflick
peterfoxflick / CountingUp.rb
Last active October 11, 2018 02:54
This is for a school project on testing if you can count with the sqrt(2) and (2 + sqrt(2)).
require 'twitter'
twitter = Twitter::REST::Client.new do |config|
config.consumer_key = "YOUR_CONSUMER_KEY"
config.consumer_secret = "YOUR_CONSUMER_SECRET"
config.access_token = "YOUR_ACCESS_TOKEN"
config.access_token_secret = "YOUR_ACCESS_SECRET"
end
def getA(n)