Skip to content

Instantly share code, notes, and snippets.

View karanjamutahi's full-sized avatar
🏠
Working from home

Karanja Mutahi karanjamutahi

🏠
Working from home
View GitHub Profile
//Here's the problem
/*
We have an array of objects representing different people in our contacts lists.
A lookUpProfile function that takes firstName and a property (prop) as arguments has been pre-written for you.
The function should check if firstName is an actual contact's firstName and the given property (prop) is a property of that contact.
If both are true, then return the "value" of that property.
@karanjamutahi
karanjamutahi / ChunkyMonkey.js
Created March 2, 2017 04:43
Trying out code for FCC
var test = ["a", "b", "c", "d","e","f","g","h","i","j"] ;
//console.log (test.length);
function chunkArrayInGroups(array,size){
var newArray =[];
for(i = 0;i<array.length;i+=size){
var a = array.slice(i,size);
console.log(a);
console.log(i);
@karanjamutahi
karanjamutahi / Filter.js
Created March 3, 2017 06:01
Trying To Filter using params
var paramArr = [];
function destroyer(arr) {
// Remove all the values
for(var i =1; i<arguments.length;++i){
paramArr.push(arguments[i]);
}
function seeker (value){
var apiURL = "";
var title = "";
$(document).ready(function(){
$.support.cors = true; //doesn't seem to do anything
$.ajaxSetup({
headers: {'Access-Control-Allow-Origin':'*',
'Content-Type':'text/plain' //trying to make it a simple request because it was sending an OPTIONS request
}
/home/thorin/esp/myledc/main/./ledc_example_main.c: In function 'app_main':
/home/thorin/esp/myledc/main/./ledc_example_main.c:164:21: error: redeclaration of 'blue' with no linkage
struct colors_t blue = {0,0,1023};
^
/home/thorin/esp/myledc/main/./ledc_example_main.c:162:7: note: previous declaration of 'blue' was here
} blue, red, green, magenta, purple, yellow, aqua,white;
^
/home/thorin/esp/myledc/main/./ledc_example_main.c:165:21: error: redeclaration of 'red' with no linkage
struct colors_t red = {1023,0,0};
^
void app_main()
{
//Config'd channels properly
struct colors_t
{
int red;
int green;
int blue;
} blue, red, green, magenta, purple, yellow, aqua,white;
#include <stdio.h>
#include "freertos/FreeRTOS.h"
#include "freertos/task.h"
#include "driver/ledc.h"
#include "esp_err.h"
#include "string.h"
#include "driver/gpio.h"
//WiFi headers
#include "esp_wifi.h"
AT+CIPRXGET=1
AT+CGATT=1
AT+SAPBR=3,1,"CONTYPE","GPRS"
AT+SAPBR=3,3,"APN", "iot.safaricom.com"
AT+SAPBR=3,3,"USER", "saf"
AT+SAPBR=3,3, "PWD", "data"
AT+CSTT="iot.safaricom.com", "saf","data"
AT+SAPBR=1,1
AT+CIICR
AT+CIFSR
For single IP connection
If “AT+CIPSRIP=1” is set, IP address and port are contained.
if <mode>=1
+CIPRXGET: 1[,<IP ADDRESS>:<PORT>]
if <mode>=2
+CIPRXGET: 2,<reqlength>,<cnflength>[,<IP ADDRESS>:<PORT>]
1234567890…
OK
if <mode>=3
Arduino: 1.8.9 (Linux), Board: "Arduino/Genuino Mega or Mega 2560, ATmega2560 (Mega 2560)"
/home/thorin/Downloads/arduino-1.8.9/arduino-builder -dump-prefs -logger=machine -hardware /home/thorin/Downloads/arduino-1.8.9/hardware -hardware /home/thorin/.arduino15/packages -tools /home/thorin/Downloads/arduino-1.8.9/tools-builder -tools /home/thorin/Downloads/arduino-1.8.9/hardware/tools/avr -tools /home/thorin/.arduino15/packages -built-in-libraries /home/thorin/Downloads/arduino-1.8.9/libraries -libraries /home/thorin/Arduino/libraries -fqbn=arduino:avr:mega:cpu=atmega2560 -vid-pid=0X2341_0X0042 -ide-version=10809 -build-path /tmp/arduino_build_727343 -warnings=all -build-cache /tmp/arduino_cache_771255 -prefs=build.warn_data_percentage=75 -prefs=runtime.tools.avr-gcc.path=/home/thorin/Downloads/arduino-1.8.9/hardware/tools/avr -prefs=runtime.tools.avr-gcc-5.4.0-atmel3.6.1-arduino2.path=/home/thorin/Downloads/arduino-1.8.9/hardware/tools/avr -prefs=runtime.tools.avrdude.path=/home/thorin/Downloads/arduino-1.8