Skip to content

Instantly share code, notes, and snippets.

View dogrocker's full-sized avatar

Kanin Peanviriyakulkit dogrocker

  • @LAMUNPUN IT
  • THAILAND
  • 20:28 (UTC +07:00)
View GitHub Profile
@dogrocker
dogrocker / API.md
Created January 11, 2016 06:24 — forked from iros/API.md
Documenting your REST API

Title

<Additional information about your API call. Try to use verbs that match both request type (fetching vs modifying) and plurality (one vs multiple).>

  • URL

    <The URL Structure (path only, no root url)>

  • Method:

@dogrocker
dogrocker / Prevent BACKSPACE from navigating back with jQuery.md
Created September 24, 2015 05:53
Prevent BACKSPACE from navigating back with jQuery (Like Google's Homepage)
$(document).on("keydown", function (e) {
    if (e.which === 8 && !$(e.target).is("input:not([readonly]):not([type=radio]):not([type=checkbox]), textarea, [contentEditable], [contentEditable=true]")) {
        e.preventDefault();
    }
});

Ref: http://stackoverflow.com/a/13756505/2126472

@dogrocker
dogrocker / Laravel 5&5.1 set active class for nav.md
Last active September 12, 2015 21:49
Laravel 5&5.1 set active class for nav

helper.php

function set_active($path, $active = 'active') {
    return call_user_func_array('Request::is', (array)$path) ? $active : '';
}

master.blade.php

@dogrocker
dogrocker / inputmask.md
Last active September 12, 2015 21:55
jQuery & Inputmask with validator and convert text to uppercase.

Example of jQuery inputmask.

  • html form
<input id="test" type="text"></input>
<button id="btn">click</button>
  • css
#test {
 text-transform:uppercase;
@dogrocker
dogrocker / autocomplete_suggest.md
Last active April 19, 2016 03:57
Autocomplete with Laravel 5.1 & Materializecss & Typeahead.js
  • View index.blade.php
<div class="row">
    {!! Form::open(['route' => 'some.route', 'autocomplete' => 'off', 'class' => 'col s12']) !!}
      <div class="row">
        <div class="input-field col s6">
          {!! Form::text('username', isset($user->username) ? $user->username : '', ['id' => 'username', 'placeholder' => '']) !!}
          {!! Form::label('username', 'Username') !!}
        </div>
      </div>
@dogrocker
dogrocker / set focus.js
Created August 2, 2015 17:48
Set mouse focus and move cursor to end of input using jQuery
// From http://stackoverflow.com/a/26761864/2126472
$('#txtSample').focus().val($('#txtSample').val());
@dogrocker
dogrocker / ESP8266 Web Server to storing ap config to EEPROM.md
Last active October 12, 2022 12:02
ESP8266 Web Server to storing ap config to EEPROM

ESP8266 Web Server to storing ap config to EEPROM.

Original by chriscook8 from esp8266.com I just modified to use ESP8266WebServer library for easy to handle the http request.

This is sample code not yet complete.

Todo

  • when Wifi connected need to close the softAP.