Skip to content

Instantly share code, notes, and snippets.

View sanampatel's full-sized avatar
💡
Something quite cool is coming up!

Sanam Patel sanampatel

💡
Something quite cool is coming up!
View GitHub Profile
#!/bin/bash
cd 'h:/homestead' #path to your homestead
vagrant halt
$SHELL
#!/bin/bash
cd 'h:/homestead' #replace with directory of homesteadinstall
vagrant up
vagrant ssh
$SHELL
@sanampatel
sanampatel / js-url-parameter.js
Created September 4, 2017 17:26
Get URL parameter with JavaScript!
function getParameterByName(name, url) {
if (!url) url = window.location.href;
name = name.replace(/[\[\]]/g, "\\$&");
var regex = new RegExp("[?&]" + name + "(=([^&#]*)|&|#|$)"),
results = regex.exec(url);
if (!results) return null;
if (!results[2]) return '';
return decodeURIComponent(results[2].replace(/\+/g, " "));
}
@sanampatel
sanampatel / jquery-url-parameter.js
Created September 4, 2017 17:23
URL Parameter with jQuery
var getUrlParameter = function getUrlParameter(sParam) {
var sPageURL = decodeURIComponent(window.location.search.substring(1)),
sURLVariables = sPageURL.split('&'),
sParameterName,
i;
for (i = 0; i < sURLVariables.length; i++) {
sParameterName = sURLVariables[i].split('=');
if (sParameterName[0] === sParam) {
@sanampatel
sanampatel / atoz.html
Created August 22, 2017 11:01
A to Z Buttons
<div class="uk-button-group uk-grid-small uk-text-center" uk-grid>
<li class="uk-button uk-button-default uk-button-small">A</li>
<li class="uk-button uk-button-default uk-button-small">B</li>
<li class="uk-button uk-button-default uk-button-small">C</li>
<li class="uk-button uk-button-default uk-button-small">D</li>
<li class="uk-button uk-button-default uk-button-small">E</li>
<li class="uk-button uk-button-default uk-button-small">F</li>
<li class="uk-button uk-button-default uk-button-small">G</li>
<li class="uk-button uk-button-default uk-button-small">H</li>
<li class="uk-button uk-button-default uk-button-small">I</li>
@sanampatel
sanampatel / database_change.sql
Last active August 17, 2017 13:49
Move table from one database to another
alter table my_old_db.mytable rename my_new_db.mytable
@sanampatel
sanampatel / 0_reuse_code.js
Created July 24, 2017 09:36
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
@sanampatel
sanampatel / csvimport.sql
Last active July 24, 2017 11:20
Import CSV file into MySQL
LOAD DATA LOCAL INFILE '<file path here>' INTO TABLE <table name here>
FIELDS TERMINATED BY ','
ENCLOSED BY '"'
LINES TERMINATED BY '\n'
(col1, col2, col3, col4, col5...);
/*
Also add below line to skip first header line from the CSV file
IGNORE 1 LINES