Skip to content

Instantly share code, notes, and snippets.

View joemar-tagpuno's full-sized avatar

Joemar Tagpuno joemar-tagpuno

View GitHub Profile
@joemar-tagpuno
joemar-tagpuno / jquery.deparam.js
Created April 19, 2016 03:35 — forked from samny/jquery.deparam.js
jQuery.deparam - The oposite of jQuery param. Creates an object of query string parameters
/**
* jQuery.deparam - The oposite of jQuery param. Creates an object of query string parameters.
*
* Credits for the idea and Regex:
* http://stevenbenner.com/2010/03/javascript-regex-trick-parse-a-query-string-into-an-object/
*/
(function($){
$.deparam = $.deparam || function(uri){
if(uri === undefined){
uri = window.location.search;
@joemar-tagpuno
joemar-tagpuno / config.php
Created May 2, 2016 05:44 — forked from HostedPCI/config.php
Php code samples
<?php
$params = new stdClass;
$params->hpci_site_host_name = baseurl();
$params->hpci_site_id = '520900';
$params->hpci_location = 'checkout1';
$params->hpci_query_string = $_SERVER['QUERY_STRING'];
$params->hpci_api_host = 'https://api-wisvis1stg.c1.hostedpci.com/';
$params->hpci_api_uid = 'ObtainTestAccount';
$params->hpci_api_pwd = '*****';
?>
@joemar-tagpuno
joemar-tagpuno / SecureSessionHandler.php
Created September 30, 2016 03:56 — forked from eddmann/SecureSessionHandler.php
Secure session handler implementation.
<?php
class SecureSessionHandler extends SessionHandler {
protected $key, $name, $cookie;
public function __construct($key, $name = 'MY_SESSION', $cookie = [])
{
$this->key = $key;
$this->name = $name;
@joemar-tagpuno
joemar-tagpuno / gist:ed5f79f8a756ac147174e2765c4b6409
Last active October 19, 2017 15:29 — forked from CristinaSolana/gist:1885435
Keeping a fork up to date

1. Clone your fork:

git clone [email protected]:YOUR-USERNAME/YOUR-FORKED-REPO.git

2. Add remote from original repository in your forked repository:

cd into/cloned/fork-repo
git remote add upstream git://github.com/ORIGINAL-DEV-USERNAME/REPO-YOU-FORKED-FROM.git
git fetch upstream
<?php
$db_con = mysqli_connect("localhost", "username", "password", "database");
$result = $db_con->query('SELECT * FROM some_table');
if (!$result) die('Couldn\'t fetch records');
$num_fields = mysqli_num_fields($result);
$headers = array();
while ($fieldinfo = mysqli_fetch_field($result)) {
$headers[] = $fieldinfo->name;
}
$fp = fopen('php://output', 'w');
@joemar-tagpuno
joemar-tagpuno / mysql-rename-db.sh
Created January 24, 2018 06:02 — forked from tadas-s/mysql-rename-db.sh
MySQL database rename script
#!/bin/bash
# Disclaimer - make backups, use at your own risk.
#
# Based on this comment: http://stackoverflow.com/a/13944924/843067
# Views and stored procedures have to be done separately.
OLDDB="old_db_name"
NEWDB="new_db_name"
MYSQL="mysql -u root -pyour_password "
@joemar-tagpuno
joemar-tagpuno / docker-help.md
Created November 23, 2018 05:33 — forked from bradtraversy/docker-help.md
Docker Commands, Help & Tips

Docker Commands, Help & Tips

Show commands & management commands

$ docker

Docker version info

<!-- HTML heavily inspired by http://blueimp.github.io/jQuery-File-Upload/ -->
<div class="table table-striped" class="files" id="previews">
<div id="template" class="file-row">
<!-- This is used as the file preview template -->
<div>
<span class="preview"><img data-dz-thumbnail /></span>
</div>
<div>
<p class="name" data-dz-name></p>
// Get the template HTML and remove it from the doumenthe template HTML and remove it from the doument
var previewNode = document.querySelector("#template");
previewNode.id = "";
var previewTemplate = previewNode.parentNode.innerHTML;
previewNode.parentNode.removeChild(previewNode);
var myDropzone = new Dropzone(document.body, { // Make the whole body a dropzone
url: "/target-url", // Set the url
thumbnailWidth: 80,
thumbnailHeight: 80,
@joemar-tagpuno
joemar-tagpuno / Git push deployment in 7 easy steps.md
Created August 2, 2019 04:01 — forked from thomasfr/Git push deployment in 7 easy steps.md
7 easy steps to automated git push deployments. With small and configurable bash only post-receive hook