Skip to content

Instantly share code, notes, and snippets.

View dogrocker's full-sized avatar

Kanin Peanviriyakulkit dogrocker

  • @LAMUNPUN IT
  • THAILAND
  • 06:47 (UTC +07:00)
View GitHub Profile
@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.
@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 / 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 / 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 / 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 / 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 / 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 / Yii2 clone table prefix function in to javascript.md
Last active April 21, 2016 02:10
Returns the actual name of a given table name.

This method will strip off curly brackets from the given table name

and replace the percentage character '%' with [[tablePrefix]].

let re = /{{(.*?)}}/g
let str = 'SELECT * FROM {{%user}} FROM WHERE id IN (?)'
let tablePrefix = 'tbl_'
console.log(str.replace(re, '$1').replace('%', tablePrefix))
@dogrocker
dogrocker / README.md
Created June 7, 2016 07:04 — forked from joyrexus/README.md
Form/file uploads with hapi.js

Demo of multipart form/file uploading with hapi.js.

Usage

npm install
npm run setup
npm run server

Then ...

Oh my zsh.

Install with curl

sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"

Enabling Plugins (zsh-autosuggestions & zsh-syntax-highlighting)

  • Download zsh-autosuggestions by