Skip to content

Instantly share code, notes, and snippets.

Avatar

Swadesh Behera itswadesh

View GitHub Profile
@itswadesh
itswadesh / myFriends.js
Created Apr 30, 2022
List of accepted friends
View myFriends.js
const query = [
{
$lookup: {
from: 'friends',
localField: '_id',
foreignField: 'userId',
as: 'friends',
},
},
{
View cloudSettings
{"lastUpload":"2020-09-16T07:58:25.777Z","extensionVersion":"v3.4.3"}
View ultrasonic-wemo-water-level.ino
#include <ESP8266WiFi.h>
#include <ESP8266mDNS.h>
#include <WiFiUdp.h>
#include <ArduinoOTA.h>
#include <FirebaseArduino.h>
#define FIREBASE_HOST "example.firebaseio.com" // optional
#define FIREBASE_AUTH "token_or_secret" // optional
#define WIFI_SSID "Wifi_Name"
#define WIFI_PASSWORD "Wifi_Password"
View angularcode-task-manager-app-updateTask.php
<?php
require_once '../includes/db.php'; // The mysql database connection script
if(isset($_GET['taskID'])){
$status = $_GET['status'];
$taskID = $_GET['taskID'];
$query="update tasks set status='$status' where id='$taskID'";
$result = $mysqli->query($query) or die($mysqli->error.__LINE__);
$result = $mysqli->affected_rows;
View angularcode-task-manager-app-deleteTask.php
<?php
require_once '../includes/db.php'; // The mysql database connection script
if(isset($_GET['taskID'])){
$taskID = $_GET['taskID'];
$query="delete from tasks where id='$taskID'";
$result = $mysqli->query($query) or die($mysqli->error.__LINE__);
$result = $mysqli->affected_rows;
View angularcode-task-manager-app-getTask.php
<?php
require_once '../includes/db.php'; // The mysql database connection script
$status = '%';
if(isset($_GET['status'])){
$status = $_GET['status'];
}
$query="select ID, TASK, STATUS from tasks where status like '$status' order by status,id desc";
$result = $mysqli->query($query) or die($mysqli->error.__LINE__);
$arr = array();
View angularcode-task-manager-app-addTask.php
<?php
require_once '../includes/db.php'; // The mysql database connection script
if(isset($_GET['task'])){
$task = $_GET['task'];
$status = "0";
$created = time();
$query="INSERT INTO tasks(task,status,created_at) VALUES ('$task', '$status', '$created')";
$result = $mysqli->query($query) or die($mysqli->error.__LINE__);
View angularcode-task-manager-app-app.js
//Define an angular module for our app
var app = angular.module('myApp', []);
app.controller('tasksController', function($scope, $http) {
getTask(); // Load all available tasks
function getTask(){
$http.post("ajax/getTask.php").success(function(data){
$scope.tasks = data;
});
};
View angularcode-task-manager-app-taskman.css
body{
font-family: 'Open Sans', sans-serif;
}
a {
color: #E1704B;
transition: color 0.5s ease;
}
a:hover{
cursor:pointer;
}
View angularcode-task-manager-app-db.php
<?php
$DB_HOST = '127.0.0.1';
$DB_USER = 'root';
$DB_PASS = '';
$DB_NAME = 'angularcode_task';
$mysqli = new mysqli($DB_HOST, $DB_USER, $DB_PASS, $DB_NAME);
?>