Skip to content

Instantly share code, notes, and snippets.

View MistrySaurabh's full-sized avatar
😊
Tea & Coding

Saurabh Mistry MistrySaurabh

😊
Tea & Coding
View GitHub Profile
@MistrySaurabh
MistrySaurabh / copyToClipboard.js
Created April 28, 2019 12:48
Copy To Clipboard Using Jquery and Javascript
// using JQuery
function copyToClipboard(element) {
var $temp = $("<input>");
$("body").append($temp);
$temp.val($(element).text()).select();
document.execCommand("copy");
$temp.remove();
}
protected function downloadCSV(Request $request){
$table = UserAccount::orderBy('created_at','desc')->with('user')->get();
$filename = "writers.csv";
$handle = fopen($filename, 'w+');
fputcsv($handle, array('user_name','user_email','mobile','account_no','account_holdername','account_type','bank_name','bank_ifsc_code','country','state','address','zip_code','city'));
foreach($table as $row) {
fputcsv($handle, array(
$row['user']['name'],
$row['user_email'],
$row['mobile'],
use GuzzleHttp\Client;
$client = new \GuzzleHttp\Client();
$response = $client->request('POST','http://51.15.140.211:3333/send',[
'headers' => [
'content-type' => 'application/x-www-form-urlencoded',
],
'form_params' => [
'name'=>$event->user->name,
$to =$user->email;
$subject = 'the subject';
$message = 'hello';
$headers = 'From: notification@weopined.com' . "\r\n" .
'Reply-To: notification@weopined.com' . "\r\n" .
'X-Mailer: PHP/' . phpversion();
mail($to, $subject, $message, $headers);
<html>
<script defer src="https://use.fontawesome.com/releases/v5.0.8/js/all.js"></script>
<input id="file" type="file" name="files[]" accept=".jpg,.jpeg,.png" multiple/>
<div id="preview"></div>
</html>
<script>
var finalFiles = {};
@MistrySaurabh
MistrySaurabh / add_update_remove_query.js
Last active March 5, 2018 04:56
How To Add / Update and Remove Query Parameter in URL by using Javascript - JQuery ?
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, " "));
}