Skip to content

Instantly share code, notes, and snippets.

View ogabrielsantos's full-sized avatar

Gabriel Santos ogabrielsantos

  • QuintoAndar
  • Brasil
View GitHub Profile
<?php
$response = '<input type="hidden" autocomplete="off" name="timezone" value="180" id="u_0_9">';
preg_match_all('/name="(.*?)" value="(.*?)"/is', $response, $names);
print_r($names);
// Output: Array ( [0] => Array ( [0] => name="timezone" value="180" ) [1] => Array ( [0] => timezone ) [2] => Array ( [0] => 180 ) )
$response = '<input type="hidden" name="jazoest" value="2703" autocomplete="off">';
preg_match_all('/name="(.*?)" value="(.*?)"/is', $response, $names);
<?php
$leaderboard_part['guild_id'] = (int) $user_all[$index]['guild_id'];
$leaderboard_part['guild_name'] = $user_all[$index]['guild_name'];
SELECT user.user_id, guild.name AS guild_name, guild.guild_id, user.gender, user.name, user.locale, user.level, user.honor
FROM user
INNER JOIN guild ON guild.guild_id = user.guild_id
ORDER BY user.honor DESC, user.level DESC, user.name DESC, user.user_id DESC
<?php
include 'db.php';
$result = $MySQLiconn->query("select table_name from information_schema.tables where table_name like 'tb%' order by 1");
$t1 = array();
while ($row = mysqli_fetch_array($result)) {
$t1[] = $row;
}
@ogabrielsantos
ogabrielsantos / classes.md
Created April 12, 2016 04:30 — forked from reinink/classes.md
How do you typically organize your classes?

By type

  • /Controllers
  • /Events
  • /Models

By topic

  • /Comments
  • /Posts
<?php
/**
* Class AdController
*/
class AdController extends Controller
{
/**
* @var array
*/
<?php
class App
{
public $controllerTitle = null;
public function beforeFilter()
{
if ($this->controllerTitle) {
$this->set('controllerTitle', $this->controllerTitle);
}
<?php
// Controller
public function add_cart($id = null)
{
$product = $this->Product->find(
'first',
array(
'recursive' => -1,
'fields' => array(
'Product.id',
<?php
// PHP 5.4+
class GenericController
{
public $limit = 99999;
public final function paginate(
$object = null,
array $scope = [],
SELECT CONVERT(CONVERT(COLUNA_ERRADA USING BINARY) USING latin1) AS latin1,
CONVERT(CONVERT(COLUNA_ERRADA USING BINARY) USING utf8) AS utf8
FROM NOME_DA_TABELA
WHERE CONVERT(COLUNA_ERRADA USING BINARY) RLIKE CONCAT('[', UNHEX('80'), '-', UNHEX('FF'), ']')