Skip to content

Instantly share code, notes, and snippets.

View bigprof's full-sized avatar

BigProf Software bigprof

View GitHub Profile
@bigprof
bigprof / mysql-php-queries.php
Last active May 2, 2018 10:59
Script to display INSERT/UPDATE/SELECT queries for a specific table in a specific database (you'll be asked for these first). The queries are suitable for use in PHP programs. Don't forget to sanitize any variables before using them in your queries! Here is a short screencast showing it in action: https://www.screencast.com/t/tvyp9P1F
<?php
/* Change the values below to match your database */
$config = [
'server' => 'localhost',
'user' => 'dbuser',
'pass' => 'password'
];
if(!isset($_REQUEST['db']) || !isset($_REQUEST['table'])) {
?>
@bigprof
bigprof / global-search.php
Last active October 1, 2022 12:34
Basic script to perform global search on all tables of an AppGini application.
<?php
/**
* Basic script to perform global search on all tables of an AppGini application.
* Create a new file inside the hooks folder and name it 'global-search.php' then copy this code to it.
* Related post: https://forums.appgini.com/phpbb/viewtopic.php?f=2&t=1689&p=4510
*/
/* Assuming this custom file is placed inside 'hooks' */
define('PREPEND_PATH', '../');
$hooks_dir = dirname(__FILE__);
@bigprof
bigprof / custom.php
Created November 27, 2017 12:43
AppGini custom page inside hooks folder
<?php
/* Assuming this custom file is placed inside 'hooks' */
define('PREPEND_PATH', '../');
$hooks_dir = dirname(__FILE__);
include("{$hooks_dir}/../defaultLang.php");
include("{$hooks_dir}/../language.php");
include("{$hooks_dir}/../lib.php");
include_once("{$hooks_dir}/../header.php");
@bigprof
bigprof / automate.js
Created June 22, 2016 19:44
Automating phantomJS using jQuery
/*
To automate phantomjs using jQuery
See also: https://github.com/ariya/phantomjs/blob/master/examples/page_events.js
*/
var url = 'http://www.sample.com'; // start url
var eval_code = function() {
// code to execute here. Use 'page' instance to navigate to other urls if needed
$("button").click();
}
<?php
/* use this code as a guide for how to fetch bitcoin historical trade data from bitcoincharts, based on Bitstamp.net */
/* historical interval in hours */
define('AVERAGE_INTERVAL', 6);
$hist = file("http://api.bitcoincharts.com/v1/trades.csv?symbol=bitstampUSD&start=" . (time() - AVERAGE_INTERVAL * 3600));
if(!is_array($hist)) die("Unable to fetch data .. Try again later!");