This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Based on blog post: https://www.sitepoint.com/how-to-build-your-own-ai-assistant-using-api-ai/ | |
// Source code: https://github.com/sitepoint-editors/Api-AI-Personal-Assistant-Demo/blob/master/index.html. | |
// Demo: https://devdiner.com/demos/barry/ | |
// When ready :) | |
jQuery(document).ready(function() { | |
/* | |
* When the user enters text in the text input text field and then the presses Enter key | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#coding=utf-8 | |
from pyfirmata import Arduino, util | |
from firebase import firebase | |
import time | |
board = Arduino('com3') | |
firebase = firebase.FirebaseApplication('https://<<MY ARDUINO PROJECT>>.firebaseio.com', None) | |
it = util.Iterator(board) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
array = [1, 3, 5, 6] | |
temp = array | |
target = 5 | |
if target in array: | |
print 'Target is in ', array.index(target) | |
else: | |
temp.append(target) | |
temp.sort() |