Skip to content

Instantly share code, notes, and snippets.

View wackyapps's full-sized avatar
🎯
Focusing

Waqas Mahmood Khan wackyapps

🎯
Focusing
  • Itelc
  • Pakistan
View GitHub Profile
import 'package:checksheett/config/AppConstants.dart';
import 'package:flutter/foundation.dart';
import 'package:graphql_flutter/graphql_flutter.dart';
class GraphQLClientConfig {
// JWT Token based GraphQL client
static Future<GraphQLClient> gqlClient(String token) async {
final HttpLink httpLink = HttpLink(AppConstants.GQL_HTTPS_URL);
final AuthLink authLink = AuthLink(
getToken: () async => 'Bearer $token',
<!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 April 11, 2019 21:24
Broadcast Stream example in 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 April 11, 2019 21:16
single subscription stream example in dart
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 October 14, 2017 13:24 — forked from luckyshot/response.php
Web scraping done right (with cUrl and user agent)
<?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 July 29, 2016 15:06 — forked from ricardoalcocer/app.js
Appcelerator Titanium Android Background Service
// 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 July 25, 2016 19:50 — 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
<?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 July 12, 2016 14:13 — 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
/**
* 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 June 30, 2016 14:50 — forked from undernewmanagement/google_autocomplete_table.js
Appcelerator titanium google places autocomplete
//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 June 17, 2016 00:47 — 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.
/***
* 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
*/
/**