Skip to content

Instantly share code, notes, and snippets.

View ganmedia's full-sized avatar

GAN Media Group ganmedia

View GitHub Profile
ganmedia / js
Created January 17, 2018 16:54
// Based on blog post:
// Source code:
// Demo:
// When ready :)
jQuery(document).ready(function() {
* When the user enters text in the text input text field and then the presses Enter key
sudo apt-get update
sudo apt-get install python3-pip python3-dev libpq-dev postgresql postgresql-contrib nginx
sudo -u postgres psql
- paste this code in postgres console:
CREATE DATABASE django_project;
CREATE USER username WITH PASSWORD 'pass1234';
ALTER ROLE username SET client_encoding TO 'utf8';
ALTER ROLE username SET default_transaction_isolation TO 'read committed';
from pyfirmata import Arduino, util
from firebase import firebase
import time
board = Arduino('com3')
firebase = firebase.FirebaseApplication('https://<<MY ARDUINO PROJECT>>', None)
it = util.Iterator(board)
from bisect import bisect_left
array = [1, 3, 5, 6]
target = 5
def element_position(array, target):
return bisect_left(array, target)
print 'Target is/or would be in ', element_position(array, target)
array = [1, 3, 5, 6]
temp = array
target = 5
if target in array:
print 'Target is in ', array.index(target)