Skip to content

Instantly share code, notes, and snippets.

Avatar
🎯
Focusing

Waqas Mahmood Khan wackyapps

🎯
Focusing
  • Itelc
  • Lahore, Pakistan
View GitHub Profile
View index.html
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
</head>
<body>
<script id="jsbin-javascript">
@wackyapps
wackyapps / stream_2.dart
Created Apr 11, 2019
Broadcast Stream example in Dart
View stream_2.dart
import 'dart:async';
void main() {
//
// Initialize a "Broadcast" Stream controller of integers
//
final StreamController<int> ctrl = StreamController<int>.broadcast();
//
// Initialize a single listener which filters out the off numbers and
@wackyapps
wackyapps / stream_1
Created Apr 11, 2019
single subscription stream example in dart
View stream_1
import 'dart:async';
void main() {
//
// Initialize a "Single-Subscription" Stream controller
//
final StreamController ctrl = StreamController();
//
// Initialize a single listener which simply prints the data
@wackyapps
wackyapps / response.php
Created Oct 14, 2017 — forked from luckyshot/response.php
Web scraping done right (with cUrl and user agent)
View response.php
<?php return array (
'url' => 'https://xaviesteve.com/',
'content_type' => 'text/html; charset=UTF-8',
'http_code' => 200,
'header_size' => 578,
'request_size' => 229,
'filetime' => -1,
'ssl_verify_result' => 0,
'redirect_count' => 0,
'total_time' => 0.27407799999999999,
@wackyapps
wackyapps / app.js
Created Jul 29, 2016 — forked from ricardoalcocer/app.js
Appcelerator Titanium Android Background Service
View app.js
// start service
var SECONDS = 20; // every 10 seconds
var intent = Titanium.Android.createServiceIntent({
url: 'logservice.js'
});
intent.putExtra('interval', SECONDS * 1000); // Needs to be milliseconds
Titanium.Android.startService(intent);
@wackyapps
wackyapps / gist:bc35919a7835e10ecfa3dcbc0e7d63cf
Created Jul 25, 2016 — forked from prime31/gist:5675017
Simple PHP script showing how to send an Android push notification. Be sure to replace the API_ACCESS_KEY with a proper one from the Google API's Console page. To use the script, just call scriptName.php?id=THE_DEVICE_REGISTRATION_ID
View gist:bc35919a7835e10ecfa3dcbc0e7d63cf
<?php
// API access key from Google API's Console
define( 'API_ACCESS_KEY', 'YOUR-API-ACCESS-KEY-GOES-HERE' );
$registrationIds = array( $_GET['id'] );
// prep the bundle
$msg = array
@wackyapps
wackyapps / physical_size.js
Created Jul 12, 2016 — forked from manumaticx/physical_size.js
Function to calculate display size as inches on android for Appcelerator Titanium with the help of https://github.com/dbankier/HasMenu
View physical_size.js
/**
* Calculates the physical display size for android devices
* e.g 4,95 for Nexus 5 or 7,02 for Nexus 7
*
* IMPORTANT: this requires https://github.com/dbankier/HasMenu
*
* @return {Number} size as inches
*/
function getPhysicalSize(){
// some infos we need
@wackyapps
wackyapps / google_autocomplete_table.js
Created Jun 30, 2016 — forked from undernewmanagement/google_autocomplete_table.js
Appcelerator titanium google places autocomplete
View google_autocomplete_table.js
//AUTOCOMPLETE TABLE
var table_data = [];
var last_search = null;
var timers = [];
// NOTE: iOS and Android keys will be different!
var IOS_API_KEY = 'xxx__APIKEY___xxx';
var ANDROID_API_KEY = '';
@wackyapps
wackyapps / Ti-touches.js
Created Jun 17, 2016 — forked from tripitakit/Ti-touches.js
Appcelerator Titanium touch events usage example: connecting a blue box to a red box with a touch and finger slide.
View Ti-touches.js
/***
* Connects the blue box to the red box with touch and finger slide.
* The window's backgroundColor and the label's text give feedback to the user.
* ... the blue box is not going to move anywhere
*
* @Copyleft 2013 Patrick De Marta
* @License GNU GPL
*/
/**
@wackyapps
wackyapps / Ti-touches.js
Created Jun 17, 2016 — forked from tripitakit/Ti-touches.js
Appcelerator Titanium touch events usage example: connecting a blue box to a red box with a touch and finger slide.
View Ti-touches.js
/***
* Connects the blue box to the red box with touch and finger slide.
* The window's backgroundColor and the label's text give feedback to the user.
* ... the blue box is not going to move anywhere
*
* @Copyleft 2013 Patrick De Marta
* @License GNU GPL
*/
/**