Skip to content

Instantly share code, notes, and snippets.

$('.dropdown-menu').hide();
// Nav Dropdown
$('#navigation li').hover(function(){
$(this).find('.dropdown-menu').toggle();
});
@AleeRojas
AleeRojas / 0_reuse_code.js
Last active August 29, 2015 14:08
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@AleeRojas
AleeRojas / widget-skeleton.php
Last active August 29, 2015 14:25 — forked from matiskay/widget-skeleton.php
Wordpress Widget Skeleton
<?php
class Widget_Name extends WP_Widget {
function Widget_Name() {
$widget_opts = array(
'classname' => 'your-awesome-class',
'description' => 'Your awesome Description',
);
@AleeRojas
AleeRojas / auto_suggest.md
Created October 27, 2015 19:10
Typeahead.js & Laravel
  • view/index.blade.php
{{ Form::open(['url' => '/profile', 'method' => 'get']) }}
	{{ Form::text('user', null, ['id'=>'users']) }}
	{{ Form::submit('GO') }}
{{ Form::close() }}
  • routes.php
Route::get('/', 'SearchController@index');
@AleeRojas
AleeRojas / intro.markdown
Created October 28, 2015 16:29 — forked from tillsanders/intro.markdown
Laravel: drag-and-drop repositioning with auto-save of DB entries

Laravel: drag-and-drop repositioning with auto-save of DB entries

Use case: Database entries are represented in a table. By grabbing and moving a row up or down the table, you can change the entries' order/position. The changes are submitted automatically via ajax.

  • Uses jQueryUI (custom download: sortable is needed)
  • newly created elements are added to the top (see route /jobs/create)
@AleeRojas
AleeRojas / CORS.php
Created December 24, 2015 03:19 — forked from fhferreira/CORS.php
Try to create - Cors Filter Laravel 5 Middleware
<?php namespace App\Http\Middleware;
use Closure;
use Illuminate\Contracts\Routing\Middleware;
use Illuminate\Http\Response;
class CORS implements Middleware {
/**
* Handle an incoming request.
<?php if (($wp_query->current_post +1) == ($wp_query->post_count)) {
echo 'This is the last post';
} ?>
<?php if (($wp_query->current_post +1) != ($wp_query->post_count)) {
echo 'This is the not the last post';
} ?>
@AleeRojas
AleeRojas / popover-dom-content.html
Created March 16, 2018 12:02 — forked from imliam/popover-dom-content.html
Bootstrap 4 - Load Popover Content From DOM
<div id="unique-id" style="display:none;">
<div class="popover-heading">This is a heading</div>
<div class="popover-body">This is HTML content that will be loaded inside a </div>
</div>
<span tabindex="0" role="button" data-toggle="popover" data-placement="bottom" data-popover-content="#unique-id">
Click me to load a popover
</span>
@AleeRojas
AleeRojas / template-literals-2-for-each.js
Created April 24, 2018 12:40 — forked from wiledal/template-literals-2-for-each.js
Template Literals example: for each
/*
Template literals forEach example
Using Array.map(), we can create a forEach within template literals.
*/
var items = [
{ name: 'Teddy' },
{ name: 'Dolores' },
{ name: 'William' },
{ name: 'Bernard' }
<?php
// GET
$request = $client->get($url, array('Accept' => 'application/json'));
$response = $request->send();
if ($response->getStatusCode() < 200 || $response->getStatusCode() >= 300) {
// Error
}