Skip to content

Instantly share code, notes, and snippets.

View randolphledesma's full-sized avatar

Randolph Ledesma randolphledesma

  • Zylun
  • Cebu City
View GitHub Profile
@randolphledesma
randolphledesma / style.css
Created April 18, 2019 03:23
progressively enhancing layouts to adopt new layout engines
/**
* @ref https://alistapart.com/article/responsible-javascript-part-1/
*/
/* Your mobile-first, non-CSS grid styles goes here */
/* The @supports rule below is ignored by browsers that don't
support CSS grid, _or_ don't support @supports. */
@supports (display: grid) {
/* Larger screen layout */
@randolphledesma
randolphledesma / file.php
Created April 15, 2019 03:24
Using Reflection to access protected properties in PHP
<?php
$class = new ReflectionClass($classInstance);
$property = $class->getProperty("properties");
$property->setAccessible(true);
$properties = $property->getValue($number);
<style type="text/css">
.video-responsive{
overflow:hidden;
padding-bottom:56.25%;
position:relative;
height:0;
}
.video-responsive iframe{
left:0;
top:0;
https://imgur.com/t/funny/aXbcT
https://imgur.com/t/funny/DOnTuLc
https://imgur.com/t/funny/JREJzod
https://imgur.com/t/funny/rOMPLIE
@randolphledesma
randolphledesma / .gitconfig
Created December 11, 2018 03:53
My gitconfig
[core]
autocrlf = false
[alias]
st = status
co = checkout
ci = commit
br = branch
hist = log --pretty=format:'%h %ad | %s%d [%an]' --graph --date=short
type = cat-file -t
dump = cat-file -p
@randolphledesma
randolphledesma / bookmarks.html
Last active November 29, 2018 22:33
Bookmarks
<!DOCTYPE html>
<html>
<!--So long and thanks for all the fish-->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Pocket Export</title>
</head>
<body>
<h1>Unread</h1>
<ul>
@randolphledesma
randolphledesma / index.js
Created November 7, 2018 06:35
Browser Testing with puppeteer
const puppeteer = require('puppeteer');
const {TimeoutError} = require('puppeteer/Errors');
const PAGE_TIMEOUT = 120000; //2 minutes
const PAGE_NAV_OPTIONS = {waitUntil: 'networkidle2', timeout: PAGE_TIMEOUT};
(async () => {
const browser = await puppeteer.launch({headless: false, slowMo: 150, args: ['--start-maximized']});
const page = await browser.newPage();
await page.setViewport({ width: 1366, height: 768});
@randolphledesma
randolphledesma / debug_helper.php
Last active December 19, 2018 05:13
PHP Debugging Utility
<?php
use Monolog\Logger;
use Monolog\ErrorHandler;
use Monolog\Formatter\CustomLineFormatter;
use Monolog\Handler\StreamHandler;
use Monolog\Processor\IntrospectionProcessor;
use Localheinz\Json\Printer\Printer;
//set this to desired log directory
@randolphledesma
randolphledesma / gmaps_reverse_geocode.json
Created October 29, 2018 23:39
Reverse Geocoding (Address Lookup) example json result
{
"plus_code" : {
"compound_code" : "JH2W+F3 Northwood, UK",
"global_code" : "9C3XJH2W+F3"
},
"results" : [
{
"address_components" : [
{
"long_name" : "49A",
@randolphledesma
randolphledesma / cmd.sh
Last active October 28, 2018 22:53
check disk caching
#!/bin/sh
### check disk caching
### @ref https://eventstore.org/blog/20131218/disabling-disk-caching-in-ubuntu/
sudo hdparm -i /dev/sda