Skip to content

Instantly share code, notes, and snippets.

View m25lazi's full-sized avatar

Mohammed Lazim m25lazi

View GitHub Profile
@m25lazi
m25lazi / designer.html
Last active August 29, 2015 14:21
designer
<link rel="import" href="../core-icon-button/core-icon-button.html">
<link rel="import" href="../core-toolbar/core-toolbar.html">
<link rel="import" href="../core-scroll-header-panel/core-scroll-header-panel.html">
<polymer-element name="my-element">
<template>
<style>
:host {
position: absolute;
@m25lazi
m25lazi / designer.html
Last active October 30, 2015 17:30
designer
<link rel="import" href="../core-input/core-input.html">
<polymer-element name="my-element">
<template>
<style>
:host {
position: absolute;
width: 100%;
height: 100%;
/*
Web client sketch for IDE v1.0.1 and w5100/w5200
Uses POST method.
Posted November 2012 by SurferTim
*/
#include <SPI.h>
#include <Ethernet.h>
byte mac[] = {
@m25lazi
m25lazi / thing.ino
Created December 19, 2015 17:10
ThingPost client
#include "ThingsPost.h"
// Enter a MAC address for your controller below.
byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
ThingsPost thing;
void setup() {
Serial.begin(9600);
@m25lazi
m25lazi / bloqClient.ino
Last active March 24, 2016 17:55
Bloq Example 1 (Control Digital/Analog Arduino pins via Bloq Server)
/*
Should include these additional libraries:
* Ethernet
* SPI
* ArduinoJson by bblanchon (https://github.com/bblanchon/ArduinoJson)
Bloq Library includes Arduino-RestClient Library by csquared (https://github.com/csquared/arduino-restclient)
Device Type - 0 : Appliance, 1 : Sensor
Data Type - 0 : Digital, 1 : Analog
@m25lazi
m25lazi / generate-pushid.js
Created April 3, 2016 13:40 — forked from mikelehen/generate-pushid.js
JavaScript code for generating Firebase Push IDs
/**
* Fancy ID generator that creates 20-character string identifiers with the following properties:
*
* 1. They're based on timestamp so that they sort *after* any existing ids.
* 2. They contain 72-bits of random data after the timestamp so that IDs won't collide with other clients' IDs.
* 3. They sort *lexicographically* (so the timestamp is converted to characters that will sort properly).
* 4. They're monotonically increasing. Even if you generate more than one in the same timestamp, the
* latter ones will sort after the former ones. We do this by using the previous random bits
* but "incrementing" them by 1 (only in the case of a timestamp collision).
*/
@m25lazi
m25lazi / Command
Created January 24, 2017 09:00
Install .app file into simulator
xcrun simctl install booted <Path to .app>
@m25lazi
m25lazi / info.plist
Created June 15, 2017 21:01
iOS 9 Application Query Schemes in info plist
<key>LSApplicationQueriesSchemes</key>
<array>
<string>fb</string>
<string>googlechrome</string>
<string>googlechromes</string>
</array>
@m25lazi
m25lazi / MyModule.js
Created June 19, 2017 20:13
Module pattern in JS
// Taken from Addy Osmani's Essential JS Design Patterns
// https://addyosmani.com/resources/essentialjsdesignpatterns/book/#constructorpatternjavascript
var myNamespace = (function () {
var myPrivateVar, myPrivateMethod;
// A private counter variable
myPrivateVar = 0;
// A private function which logs any arguments
@m25lazi
m25lazi / inception-predition.swift
Created August 5, 2017 06:28
Using Inception Model to predict the object
var model = Inceptionv3()
let output = try? model.prediction(image: pixelBuffer)
let prediction = output?.classLabel ?? “I don’t know! 😞”