Skip to content

Instantly share code, notes, and snippets.

View domadev812's full-sized avatar
😊
Always be ready!

Full-Stack Web Developer domadev812

😊
Always be ready!
View GitHub Profile
@domadev812
domadev812 / 1.xml
Last active November 15, 2017 21:05 — forked from ToeJamson/1.xml
android push notification intro tutorial
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
<permission android:name="your.package.name.permission.C2D_MESSAGE" android:protectionLevel="signature" />
<uses-permission android:name="your.package.name.permission.C2D_MESSAGE" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
@domadev812
domadev812 / 1
Last active November 15, 2017 21:05 — forked from ToeJamson/1
Tutorial: Building a Raspberry Pi Smart Home (Part 1)
h,t = dht.read_retry(dht.DHT22, 4)
print 'Temp={0:0.1f}*C Humidity={1:0.1f}%'.format(t, h)
@domadev812
domadev812 / cordova-01.html
Last active November 15, 2017 21:05 — forked from girliemac/cordova-01.html
Snippets for blog, "Sending iOS Push Notifications via APNS in JavaScript using PhoneGap and PubNub"
<script type="text/javascript" src="js/PushNotification.js"></script>
<script src="https://cdn.pubnub.com/sdk/javascript/pubnub.4.17.0.js"></scrip>
@domadev812
domadev812 / 01.py
Last active November 15, 2017 21:05 — forked from girliemac/01.py
Code samples for IoT 101 with Raspberry Pi Blog: http://www.pubnub.com/blog/internet-of-things-101-getting-started-w-raspberry-pi/
import sys
from pubnub.callbacks import SubscribeCallback
from pubnub.pnconfiguration import PNConfiguration
from pubnub.pubnub import PubNub
pnconfig = PNConfiguration()
pnconfig.subscribe_key = "my_subkey"
pnconfig.publish_key = "my_pubkey"
pnconfig.ssl = False
@domadev812
domadev812 / 1.java
Last active November 15, 2017 21:05 — forked from ToeJamson/1.java
Android Beacon Tutorial (Building the Detector - Listener - Observer)
private void setScanFilter() {
ScanFilter.Builder mBuilder = new ScanFilter.Builder();
ByteBuffer mManufacturerData = ByteBuffer.allocate(23);
ByteBuffer mManufacturerDataMask = ByteBuffer.allocate(24);
byte[] uuid = getIdAsByte(UUID.fromString("0CF052C297CA407C84F8B62AAC4E9020");
mManufacturerData.put(0, (byte)0xBE);
mManufacturerData.put(1, (byte)0xAC);
for (int i=2; i<=17; i++) {
mManufacturerData.put(i, uuid[i-2]);
}
@domadev812
domadev812 / index.html
Last active November 15, 2017 21:06 — forked from dristic/index.html
Header section for PubNub Messenger.
<head>
<title>PubNub Messenger</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black">
<link rel="apple-touch-icon href=icon.png">
<link rel="apple-touch-startup-image href=startup.png">
@domadev812
domadev812 / messenger.js
Last active November 15, 2017 21:06 — forked from ToeJamson/messenger.js
pubnub messenger v2
$(document).ready(function () {
// Initialize the PubNub API connection.
pubnub = new PubNub({
publishKey : 'PUBNUB PUBLISH KEY HERE',
subscribeKey : 'PUBNUB SUBSCRIBE KEY HERE'
})
// Grab references for all of our elements.
var messageContent = $('#messageContent'),
sendMessageButton = $('#sendMessageButton'),
@domadev812
domadev812 / cordova-1.html
Last active November 15, 2017 21:05 — forked from girliemac/cordova-1.html
Snippets for blog, "Sending Android Push Notifications via GCM in JavaScript using PhoneGap and PubNub"
<script type="text/javascript" src="js/PushNotification.js"></script>
<script src="https://cdn.pubnub.com/sdk/javascript/pubnub.4.17.0.js"></script>
@domadev812
domadev812 / 1.js
Last active November 15, 2017 21:05 — forked from ToeJamson/1.js
Vehicle Tracking on Realtime Maps
var drivers = [
{ latlng: [30.370375, -97.756138] },
{ latlng: [30.323118, -97.739144] },
{ latlng: [30.302816, -97.699490] },
{ latlng: [30.293479, -97.742405] },
{ latlng: [30.250337, -97.754593] },
{ latlng: [30.236689, -97.762730] }
];
@domadev812
domadev812 / pubnub-js-publish
Last active November 15, 2017 21:05 — forked from shyampurk/pubnub-js-publish
pubnub_iot_tech_uc_1
$('#toggle').click(function(e){
pubmsg = { "req" : "toggle" };
var publishConfig = {
channel : 'gpio-raspberry-control',
message : pubmsg
}
pubnub.publish(publishConfig, function(status, response) {
console.log(status, response);