Skip to content

Instantly share code, notes, and snippets.

View MiniCodeMonkey's full-sized avatar

Mathias Hansen MiniCodeMonkey

View GitHub Profile
<?php
add_action('pre_get_posts', function ($query) {
global $wp;
if (!is_admin() && $query->is_main_query()) :
if ($wp->request == '.custom-hidden-endpoint-wordpress-way-is-a-death-trap') {
header('Content-Type: application/json');
echo json_encode(array('hi' => 'mathias'));
exit;
endif;
@clouddueling
clouddueling / feed.php
Last active December 14, 2015 03:29
Long pulling with Laravel
<?php
class Feed_Controller extends Base_Controller
{
public $layout = 'layouts.feed';
public function get_index()
{
$records = Record::where_deleted(0)
->order_by('updated_at', 'desc')
@MiniCodeMonkey
MiniCodeMonkey / gist:2942281
Last active October 6, 2015 05:17
Basecamp - Find yourself in a project
/*
* Instructions:
* Paste one of the following snippets in your browsers Javascript console
*/
// Remove all others than yourself
var n = "Mathias Hansen"; $("li.todo").each(function () { if ($.trim($(this).find("span .pill").find("span span").html()) != n) { $(this).remove(); } });
// Mark your name with a color
var n = "Mathias Hansen"; $("li.todo").each(function () { var o = $(this).find("span .pill").find("span span"); if ($.trim(o.html()) == n) { o.css('color', '#000'); o.parent().css('background-color', 'yellow'); } });