Skip to content

Instantly share code, notes, and snippets.

View setkyar's full-sized avatar
🧘‍♂️

Set Kyar Wa Lar (Universe) setkyar

🧘‍♂️
View GitHub Profile
@setkyar
setkyar / install.ssh
Created May 22, 2014 10:24
My Vagrant-Setup ssh
#!/usr/bin/env bash
echo "--- Hello, master. Let's get to work. Installing now. ---"
echo "--- Updating packages list ---"
sudo apt-get update
echo "--- MySQL time ---"
sudo debconf-set-selections <<< 'mysql-server mysql-server/root_password password root'
sudo debconf-set-selections <<< 'mysql-server mysql-server/root_password_again password root'
@setkyar
setkyar / html-option-loop
Last active August 29, 2015 14:04
Looping For Option
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
<option value="5">5</option>
var select = document.getElementById("demo");
var i=0;
for(i=1;i<=5;i++){
@setkyar
setkyar / add-new-row-with-dynamic-row
Last active August 29, 2015 14:04
Add New Row with Dynamic name
<!-- First Create a Template to append -->
<script type="text/plain" id="row_template" >
<tr>
<td><input type="text" Placeholder="Simple" data-property="first_simple"></td>
<td><input type="text" Placeholder="Simple" data-property="second_simple"></td>
<td><input type="text" Placeholder="Simple" data-property="third_simple"></td>
</tr>
</script>
@setkyar
setkyar / JS Date Notes
Last active August 29, 2015 14:04
JavaScript Date Notes
## [To get first and last day of the month in js](http://stackoverflow.com/questions/13571700/get-first-and-last-date-of-current-month-with-javascript-or-jquery)
var date = new Date();
var firstDay = new Date(date.getFullYear(), date.getMonth(), 1);
var lastDay = new Date(date.getFullYear(), date.getMonth() + 1, 0);
## For Month Select
function dateDropdown(select) {
@setkyar
setkyar / 0_reuse_code.js
Created August 7, 2014 08:38
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
@setkyar
setkyar / variable_in_blade.php
Created October 22, 2014 05:13
Assign variable in Laravel
{{ ''; $your_variable_name = 'Your Variable Value'; }}
@setkyar
setkyar / vim
Created December 24, 2014 04:24
VIM
//Deteact keyboard code when user type to the input
$('input').on('keydown', function (e) {
console.log(e.keyCode);
})
//For esc/i/j and k
$(document).keyup(function(e) {
if (e.keyCode == 27) { alert('esc') } // esc
if (e.keyCode == 73) { alert('i') } // i insert mode
if (e.keyCode == 74) { alert('j') } // j left
@setkyar
setkyar / helper
Created January 23, 2015 07:29
Laravel 4 Helper Class Function
//Create New Folder Call MyClass on `app/` directory
Add new line on `/app/start/global.php`
ClassLoader::addDirectories(array(
app_path().'/commands',
app_path().'/controllers',
app_path().'/models',
app_path().'/database/seeds',
app_path().'/MyClass', // This line is the one we need to add
@setkyar
setkyar / printSpecificElement.js
Created January 28, 2015 10:29
Print Specific Element
function printout() {
var newWindow = window.open();
newWindow.document.write(document.getElementById("out").innerHTML);
newWindow.print();
}
@setkyar
setkyar / Elegant.php
Created February 3, 2015 10:47
Laravel Validation on Model
/**
* Create a new Elegant class
* And use that class from your model
*/
class Elegant extends Eloquent
{
protected $rules = array();
protected $errors;