Skip to content

Instantly share code, notes, and snippets.

$(document).on("click", ".tt-footer a", function(e){
e.preventDefault();
var $this = $(this), query = $(".typeahead").val();
$this.attr('href', $this.attr('href').replace('%QUERY', query));
window.location = $this.attr('href');
});
// When user select or click one of suggestion
$('.typeahead').on("typeahead:selected",function(object, datum){
// Store the information
Config.stateUrl = datum.url;
Config.stateName = datum.name;
window.location.href = Config.stateUrl;
});
/*
* typehead.js-bootstrap3.less 0.1.4
* https://github.com/hyspace/typehead.js-bootstrap3.less
*
* Licensed under the MIT license:
* http://www.opensource.org/licenses/MIT
*/
.twitter-typeahead .tt-query,
.twitter-typeahead .tt-hint {
margin: 0;
// for more information please read typeahead.js documentation
$(".typeahead").typeahead({
// Set an ID
name: "Posts",
// Option about information where the source data to be fetch
remote: {
// the url request
<script>
// using anonymous function closure
!(function(){
// Config namespace
var Config = {
domain: location.hostname, // read the current domain
protocol: /^http:/.test(document.location) ? "http" : "https", // determine the protocol
thumbnailSize: 48, // the size of thumbnail image
searchResult: 5, // max results of searching
@clusteramaryllis
clusteramaryllis / autocomplete-form.html
Last active August 29, 2015 14:17
autocomplete form
<form action="/search" method="get">
<input type="text" class="typeahead" name="q"/>
<button type="submit">Submit</button>
</form>
@clusteramaryllis
clusteramaryllis / file.html
Last active August 29, 2015 14:17
autocomplete main file
<head>
<!-- other header code -->
<!-- this bootstrap stylesheet only for experiment, -->
<!-- you don't have to include this stylesheet -->
<link rel="stylesheet" href="//cdn.jsdelivr.net/bootstrap/3.0.3/css/bootstrap.min.css" />
<!-- according to typeahead.js site, -->
<!-- need jquery version 1.9.1 and above -->
@clusteramaryllis
clusteramaryllis / template-spoiler
Created March 1, 2015 07:48
Template spoiler backup
{| style="text-align:center; background:#D3E1F2; color:#000; border:1px solid #AAA; margin-bottom:10px;" cellpadding=8
|-
| '''Beware of Spoilers!'''<br/>This article contains plot details about upcoming or newly released content! Read at your own risk!
|}<noinclude>
{{documentation}}</noinclude>
6237323688
@clusteramaryllis
clusteramaryllis / pr.md
Last active August 29, 2015 14:14 — forked from piscisaureus/pr.md

Locate the section for your github remote in the .git/config file. It looks like this:

[remote "origin"]
	fetch = +refs/heads/*:refs/remotes/origin/*
	url = git@github.com:joyent/node.git

Now add the line fetch = +refs/pull/*/head:refs/remotes/origin/pr/* to this section. Obviously, change the github url to match your project's URL. It ends up looking like this: