- bootstrap with typeahead
- jquery
This will use bootstrap with typeahead to create an autocomplete search.
The idea is to have nginx installed and node installed. I will extend this gist to include how to install those as well, but at the moment, the following assumes you have nginx 0.7.62 and node 0.2.3 installed on a Linux distro (I used Ubuntu).
In a nutshell,
So for example, www.foo.com request comes and your css, js, and images get served thru nginx while everything else (the request for say index.html or "/") gets served through node.
| <?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', | |
| ); |
| public static function read_search($terms, $limit = 20) | |
| { | |
| $contact_results = Contact::where_account_user_id(Auth::user()->account_user_id) | |
| ->where_deleted(0) | |
| ->where_marketing(0) | |
| ->where_mass_merge(0) | |
| ->raw_where("match (`first`, `last`) against (?)", array($terms)) | |
| ->take($limit) | |
| ->get(); |
| // ----------- | |
| // Debugger that shows view port size. Helps when making responsive designs. | |
| // ----------- | |
| function showViewPortSize(display) { | |
| if(display) { | |
| var height = jQuery(window).height(); | |
| var width = jQuery(window).width(); | |
| jQuery('body').prepend('<div id="viewportsize" style="z-index:9999;position:fixed;top:40px;left:5px;color:#fff;background:#000;padding:10px">Height: '+height+'<br>Width: '+width+'</div>'); | |
| jQuery(window).resize(function() { |
| <?php | |
| class Post | |
| { | |
| protected $table = 'posts'; | |
| /** | |
| * You can define your own custom boot method. | |
| * | |
| * @return void | |
| **/ |
| $(document).ready(function() { | |
| // Support for AJAX loaded modal window. | |
| // Focuses on first input textbox after it loads the window. | |
| $('[data-toggle="modal"]').click(function(e) { | |
| e.preventDefault(); | |
| var url = $(this).attr('href'); | |
| if (url.indexOf('#') == 0) { | |
| $(url).modal('open'); | |
| } else { |
| <?php | |
| /** | |
| * @param string $domain Pass $_SERVER['SERVER_NAME'] here | |
| * @param bool $debug | |
| * | |
| * @debug bool $debug | |
| * @return string | |
| */ | |
| function get_domain($domain, $debug = false) | |
| { |
| var app = require(process.cwd() + '/app'); | |
| var winston = require('winston'); | |
| var _ = require('lodash'); | |
| // Set up logger | |
| var customColors = { | |
| trace: 'white', | |
| debug: 'green', | |
| info: 'green', | |
| warn: 'yellow', |
| // Includes functions for exporting active sheet or all sheets as JSON object (also Python object syntax compatible). | |
| // Tweak the makePrettyJSON_ function to customize what kind of JSON to export. | |
| var FORMAT_ONELINE = 'One-line'; | |
| var FORMAT_MULTILINE = 'Multi-line'; | |
| var FORMAT_PRETTY = 'Pretty'; | |
| var LANGUAGE_JS = 'JavaScript'; | |
| var LANGUAGE_PYTHON = 'Python'; |