Skip to content

Instantly share code, notes, and snippets.

View AndresMWeber's full-sized avatar
💭
Katas for Life!

Andres Weber AndresMWeber

💭
Katas for Life!
View GitHub Profile
@AndresMWeber
AndresMWeber / TicTacToe.py
Last active December 12, 2017 21:32
Fo bobbay
class State(object):
X = 'X'
O = 'O'
NULL = '-'
def __init__(self, row1=None, row2=None, row3=None):
self.rows = [row or [self.NULL]*3 for row in [row1, row2, row3]]
self.turn = self.O
@property
def horizontal_rows(self):
# hand_instance.controls.finger.fk[0]
# hand_instance.finger.controls.fk[0]
# hand_instance.controls_finger_ik_0
# hand_instance.fk.controls.finger[0]
# hand_instance.finger.fk.controls[0]
# hand_instance.fingers[0].controls[2]
# hand_instance.fingers[0].controls.fk[2]
hand_instance.hierarchy = {‘fingers’: [
/**
* Counts a guest's name that is not highlighted nor has strikethrough
*
* @return The value of all the guests.
* @customfunction
*/
function COUNTGUESTS(){
var ss = SpreadsheetApp.getActiveSpreadsheet();
var sheet = SpreadsheetApp.getActiveSheet();
var formula = SpreadsheetApp.getActiveRange().getFormula();
@AndresMWeber
AndresMWeber / coroutine.py
Created June 25, 2019 18:17
Testing out a Notifier to connect a loop to a separate function
import asyncio
async def shout(msg):
print(msg.upper())
class Notifier(object):
def __init__(self):
self._listeners = []
@AndresMWeber
AndresMWeber / UI_loop_template.py
Created June 25, 2019 18:53
Template for updating a bokeh loop with data to plot.
class Data(object):
def __init__(self, source_file):
self.source = source_file
self.routes = None
def update(self):
self.routes = self.calculate()
return self.routes
def calculate(self):
@AndresMWeber
AndresMWeber / source.py
Last active June 26, 2019 01:39
Showing where to put the source
class PlotLoop(object):
def __init__(self):
self.data = Data('data_source_file')
self.source = ColumnDataSource(data=dict(xs=np.random.rand(50, 2).tolist(), ys=np.random.rand(50, 2).tolist()))
self.init_plot()
def init_plot(self):
""" Initialize the plot with data from self.data
"""
@AndresMWeber
AndresMWeber / convert.js
Created October 7, 2019 17:41
Convert CSV to JSON Example
/**
* This is meant to be run on data.csv coming in from Talal. It only converts to JSON and hardcodes the filepath.
*/
function convertCSVtoJSON() {
csv()
.fromFile('data.csv')
.then((crimeDataSet) => {
fs.writeFile("data.json", JSON.stringify(crimeDataSet), 'utf8', function(err) {
if (err) {
@AndresMWeber
AndresMWeber / README.md
Created February 16, 2020 00:07
Explanation for For the Love of IoT

Yeah I don't have a specific tutorial but here's what worked for me:

I did Tools-->Port-->(change this one by one and hit upload). That should help you find the successful proper serial port you connected your arduino to on your computer.

After that this is what the example cURL command was that I sent to the Heroku REST API that successfully POSTs and shows up on my device screen (I just tested it now too):

curl --location --request POST 'messaging-thing-api.herokuapp.com/api/messaging' \
--header 'Content-Type: application/json' \
--data-raw '{