Skip to content

Instantly share code, notes, and snippets.

View mibrahim's full-sized avatar

Mohamed Ibrahim mibrahim

  • FINRA
  • Rockville, MD
View GitHub Profile
@mibrahim
mibrahim / cache.php
Created May 31, 2017 19:27
php caching
https://davidwalsh.name/php-cache-function
/* gets the contents of a file if it exists, otherwise grabs and caches */
function get_content($file,$url,$hours = 24,$fn = '',$fn_args = '') {
//vars
$current_time = time(); $expire_time = $hours * 60 * 60; $file_time = filemtime($file);
//decisions, decisions
if(file_exists($file) && ($current_time - $expire_time < $file_time)) {
//echo 'returning from cached file';
return file_get_contents($file);
@mibrahim
mibrahim / phoenix index bug
Created September 21, 2014 00:07
Issue with maintaining index with not null
0: jdbc:phoenix:localhost> create table test.testing(k integer primary key, v bigint not null);
No rows affected (2.547 seconds)
0: jdbc:phoenix:localhost> upsert into test.testing(k,v) values(1, 5);
1 row affected (0.014 seconds)
0: jdbc:phoenix:localhost> select * from test.testing;
+------------+------------+
| K | V |
+------------+------------+