This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class Game | |
{ | |
public static function pointsFromLevel($level) | |
{ | |
// http://rsdo.net/rsdonline/guides/Experience%20formula.html#PHP | |
$a=0; | |
for($x=1; $x < $level; $x++) { | |
$a += floor($x+300*pow(2, ($x/7))); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static function search_contacts($terms) | |
{ | |
$search_all = ! Input::has('first') && ! Input::has('last'); | |
$terms = escape($terms); | |
$search_terms = explode(' ', $terms); | |
$search_term_bits = array(); | |
foreach ($search_terms as $term) { | |
$term = trim($term); | |
if (! empty($term)) { | |
if ((Input::has('first') && Input::has('last')) || $search_all) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class Home_Controller extends Base_Controller | |
{ | |
public function get_run() | |
{ | |
phpconsole("WORKER: Initializing the CloudWorker."); | |
$love = true; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static function search_contacts($terms) | |
{ | |
$search_all = ! Input::has('first') && ! Input::has('last'); | |
$terms = escape($terms); | |
$search_terms = explode(' ', $terms); | |
$search_term_bits = array(); | |
foreach ($search_terms as $term) { | |
$term = trim($term); | |
if (! empty($term)) { | |
if ((Input::has('first') && Input::has('last')) || $search_all) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static function search_contacts($terms) | |
{ | |
$terms = escape($terms); | |
$contacts = Contact::where_account_user_id(Auth::user()->account_user_id) | |
->raw_where("match (`first`, `last`) against ('{$terms}*' IN BOOLEAN MODE)", array()) | |
->where_account_user_id(Auth::user()->account_user_id) | |
->where_deleted(0) | |
->take(20) | |
->get(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static function search_contacts($terms) | |
{ | |
$terms = mysql_real_escape_string($terms); | |
$contact_results = Contact::where_account_user_id(Auth::user()->account_user_id) | |
->raw_where("match (`first`, `last`) against ('{$terms}*' IN BOOLEAN MODE)") | |
->where_deleted(0) | |
->paginate(20); | |
phpconsole($contact_results->results); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class BlogController extends Controller | |
{ | |
/** | |
* Posts | |
* | |
* @return void | |
*/ | |
public function showPosts() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// if you need the strtolower or some other data tweaks. | |
// remember me | |
$remember = Input::get('remember'); | |
$credentials = array( | |
'username' => strtolower(Input::get('email')), | |
'password' => Input::get('password'), |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Resizer and Image Manipulation | |
// Based on: http://forums.laravel.com/viewtopic.php?id=2648 | |
public function post_edit_logo($id) | |
{ | |
$rules = array( | |
'image' => 'image', | |
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT id, nombre, (6371 * ACOS( | |
SIN(RADIANS(lat)) * SIN(RADIANS(4.6665578)) | |
+ COS(RADIANS(lng - -74.0524521)) * COS(RADIANS(lat)) | |
* COS(RADIANS(4.6665578)) | |
) | |
) AS distance | |
FROM direcciones | |
HAVING distance < 1 /* 1 KM a la redonda */ | |
ORDER BY distance ASC |
OlderNewer