Skip to content

Instantly share code, notes, and snippets.

View MissAllSunday's full-sized avatar

Michel Mendiola MissAllSunday

  • Ohara
  • CDMX
View GitHub Profile
before:
throw new RuntimeException(isset($content['message']) ? $content['message'] : $content, $response->getStatusCode());
now:
try
{
throw new RuntimeException(isset($content['message']) ? $content['message'] : $content, $response->getStatusCode());
}
@MissAllSunday
MissAllSunday / gist:5554848
Created May 10, 2013 14:44
check API status
protected function getAPIStatus()
{
$apiUrl = 'https://status.github.com/api/status.json';
$check = json_decode($this->fetch_web_data($apiUrl));
if (empty($check))
return false;
if (!empty($check) && is_object($check))
// Doctrine
$sql = "SELECT * FROM articles WHERE id = ?";
$stmt = $conn->prepare($sql);
$stmt->bindValue(1, $id);
$stmt->execute();
// SMF
$result = $this->_smcFunc['db_query']('', '
SELECT *
FROM articles
filter: function(query, data, search_key) {
var _this = this;
return $.map(data, function(item, i) {
var name;
name = $.isPlainObject(item) ? item[search_key] : item;
if (name.toLowerCase().indexOf(query) >= 0) {
return item;
}
});
},
protected function returnResponse()
{
global $modSettings;
// kill anything else
ob_end_clean();
if (!empty($modSettings['enableCompressedOutput']))
@ob_start('ob_gzhandler');