Skip to content

Instantly share code, notes, and snippets.

View arielmagbanua's full-sized avatar
🏠
Working from home

Ariel Magbanua arielmagbanua

🏠
Working from home
View GitHub Profile
@arielmagbanua
arielmagbanua / center.blade.php
Created October 11, 2020 21:56
Center Div Laravel Bootstrap
@extends('layouts.app-nonav')
@section('styles')
<style>
div.container{
height: calc(100vh - 16px);
}
div.login {
width: 100%;
@arielmagbanua
arielmagbanua / colorblind.js
Created September 12, 2020 11:52
TensorFlowJs Advanced Manipulation rg blind
// TensorPlayground.com
// https://images.unsplash.com/photo-1506108928571-9f4b11ba3f10?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=1350&q=80
// INPUT TENSOR SHAPE: [901,1350,3]
(tf, aTensor) => {
const height = aTensor.shape[0]
const width = aTensor.shape[1]
const halfHeight = (height - 1) / 2
console.log(halfHeight)
@arielmagbanua
arielmagbanua / TestIbsQueryBuilder.cs
Created February 20, 2020 15:00
Test Class for IbsQueryBuilder.cs
using Microsoft.VisualStudio.TestTools.UnitTesting;
namespace ConsoleNancySelfHostedNetTest
{
[TestClass]
public class TestIbsQueryBuilder
{
public class MyModel : IbsQueryBuilder
{
@arielmagbanua
arielmagbanua / IbsQueryBuilder.cs
Created February 20, 2020 14:58
IbsQueryBuilder Abstract Class that Mimics Laravel ORM for IBS Gateway Builder
using System;
using System.Text.RegularExpressions;
namespace ConsoleNancySelfHostedNetTest
{
public abstract class IbsQueryBuilder
{
private string _queryCriteria = "";
public virtual IbsQueryBuilder Where(string col, string arg1, string arg2 = null)
@arielmagbanua
arielmagbanua / hi-satellite.md
Created August 11, 2019 06:20 — forked from MariadeAnton/hi-satellite.md
Travis CI Demo Examples - GitHub Satellite 2019
@arielmagbanua
arielmagbanua / workbox.md
Created August 6, 2019 16:44 — forked from addyosmani/workbox.md
Workbox recipes

Workbox runtime caching recipes

Your Service Worker script will need to import in Workbox and initialize it before calling any of the routes documented in this write-up, similar to the below:

importScripts('workbox-sw.prod.v1.3.0.js');
const workbox = new WorkboxSW();

// Placeholder array populated automatically by workboxBuild.injectManifest()
OK that makes sense. I'm not 100% familiar with PHPUnit & didn't notice the @Depends comments etc. I'm fine with that.
There will always be exceptions to the rule, but in general we don't want to be testing private variables IMO. In my mind, the normal progression of TDD I'd generally start from the "outside of the black box", and work my way in only if I really have to. E.g. calling methods from the interface first - e.g something like this (TEST=update test, CODE=update code base):
TEST: Instantiate Flow\Schema\Register\Blueprint
CODE: Create empty version of that class with a constructor
TEST: $definition = $blueprint->definitions();
CODE: create definitions method doing nothing
TEST: assert $definition is a collection
CODE: instantiate $this->definitions = collection, and update definitions method to return it
@arielmagbanua
arielmagbanua / docker-compose.yml
Created January 19, 2019 14:04
Example of Simple Docker Compose file
version: '3'
services:
redis-server:
image: 'redis'
node-app:
build: .
ports:
- '4001:8081'
@arielmagbanua
arielmagbanua / DockerCommands.txt
Last active January 18, 2019 06:49
Docker Commands
// running and creating a container
docker run <image>
docker run -d <image> # background
// running and creating a container
docker create <image>
docker start -a <container_id>
// list the containers
docker ps —all
@arielmagbanua
arielmagbanua / hexToBinaryAndWrite.php
Last active November 25, 2022 05:19
Convert Hex LONGBLOB to Image in Laravel
<?php
// references
// https://stackoverflow.com/questions/13274691/coverting-hex-to-image-in-php
// https://stackoverflow.com/questions/45711484/how-to-convert-image-stored-in-db-as-hex-into-visible-image
$hexString = '0xffd8ffe000104a46494600010100000100010000ffe103224578696600004d4d002a00000008000c010e0002000000200000009e010f000200000012000000be011000020000000b000000d0011200030000000100010000011a000500000001000000dc011b000500000001000000e40128000300000001000200000131000200000020000000ec01320002000000140000010c013b00020000000c00000120829800020000000c0000012c87690004000000010000013800000000557273696e69612063616c656e64756c69666f6c6961203230303730313939004e494b4f4e20434f52504f524154494f4e004e494b4f4e20443730300000002dc6c000002710002dc6c00000271041646f62652050686f746f73686f702043533620284d6163696e746f73682900323031373a31303a30392031373a32353a313500486f77617264205269636500486f776172642052696365000020829a000500000001000002be829d000500000001000002c6882200030000000100030000882700030000000100c800009000000700000004