Skip to content

Instantly share code, notes, and snippets.

View Kaoschuks's full-sized avatar

Favour Chukwuemeka Kaoschuks

View GitHub Profile
@Kaoschuks
Kaoschuks / ObjectListener.php
Created June 11, 2016 15:49 — forked from soyuka/ObjectListener.php
Streaming big json files the good way with php with https://github.com/salsify/jsonstreamingparser
<?php
/**
* This implementation allows to process an object at a specific level
* when it has been fully parsed
*/
class ObjectListener implements \JsonStreamingParser_Listener {
/** @var string Current key **/
private $_key;
@Kaoschuks
Kaoschuks / svgtest.html
Created August 29, 2016 02:52 — forked from bencates/svgtest.html
Draw a SVG hexagonal grid
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>SVG Test</title>
</head>
<body>
<svg id="s" version="1.1"
width="300" height="300"
xmlns="http://www.w3.org/2000/svg">
@Kaoschuks
Kaoschuks / index.php
Created September 2, 2016 12:34 — forked from ziadoz/index.php
Simple PHP / jQuery CSRF Protection
<?php
// See: http://blog.ircmaxell.com/2013/02/preventing-csrf-attacks.html
// Start a session (which should use cookies over HTTP only).
session_start();
// Create a new CSRF token.
if (! isset($_SESSION['csrf_token'])) {
$_SESSION['csrf_token'] = base64_encode(openssl_random_pseudo_bytes(32));
}
@Kaoschuks
Kaoschuks / app.js
Created February 25, 2017 12:20 — forked from jgoux/app.js
Ionic / AngularJS service wrapper for Web SQL API / SQLite-Cordova-Plugin
angular.module('myApp', ['ionic', 'myApp.services', 'myApp.controllers'])
.run(function(DB) {
DB.init();
});
@Kaoschuks
Kaoschuks / 112-ionic-with-responsive-table.markdown
Created June 13, 2019 19:21
112 Ionic With Responsive Table
// Get measurements for a new flower to generate a prediction
// The first argument is the data, and the second is the shape.
const inputData = tf.tensor2d([[4.8, 3.0, 1.4, 0.1]], [1, 4]);
// Get the highest confidence prediction from our model
const result = model.predict(inputData);
const winner = irisClasses[result.argMax().dataSync()[0]];
// Display the winner
console.log(winner);
<?xml version='1.0' encoding='utf-8'?>
<widget id="io.hyn.app" version="0.0.1" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
<name>Hyn</name>
<description>An awesome Ionic/Cordova app.</description>
<author email="hi@ionicframework" href="http://ionicframework.com/">Ionic Framework Team</author>
<content src="index.html" />
<access origin="*" />
<allow-navigation href="*" />
<allow-intent href="http://*/*" />
<allow-intent href="https://*/*" />
@Kaoschuks
Kaoschuks / app.component.ts
Created March 13, 2021 18:24
Ionic capacitor push notification using capacitor plugin and angular fire
import { Component } from '@angular/core';
import { FcmProvider } from './providers/core/fcm';
import { GlobalsProvider } from './providers/core/globals';
import { environment } from 'src/environments/environment.prod';
@Component({
selector: 'app-root',
templateUrl: 'app.component.html',
styleUrls: ['app.component.scss']
@Kaoschuks
Kaoschuks / cloudinary_upload.ts
Created March 13, 2021 18:41
cloudinary api upolad
let cloudinary = {
upload_preset: '',
url: ''
}
async upload(file: Blob) {
return await new Promise((resolve, reject) => {
try {
const myFormData = new FormData();
myFormData.append("file", file);
myFormData.append("upload_preset", cloudinary.upload_preset);