Skip to content

Instantly share code, notes, and snippets.

💭
Nuxt is awesome but my blog (comedymood.com) is more. isn' t?

SUDHIR K GUPTA sudhir600

💭
Nuxt is awesome but my blog (comedymood.com) is more. isn' t?
Block or report user

Report or block sudhir600

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@sudhir600
sudhir600 / count_keys_in_array.js
Created Aug 1, 2019
Get total numbers of same key in array
View count_keys_in_array.js
// E.g
// let array = ["sudhir", "hello", "test", "sudhir", "a", "a", "a"]
//output = sudhir:2, hello:1, test: 1 and a:3
countKey(array){
let obj = {}
array.forEach(function(i){
if(obj[i] == undefined){
obj[i] = 0
}
@sudhir600
sudhir600 / dynamically_chosen.html
Created Jul 12, 2019
Apply Jquery Chosen On Dynamically Added Select-element
View dynamically_chosen.html
<!DOCTYPE html>
<html lang="en">
<head>
<link rel="stylesheet" href="https://harvesthq.github.io/chosen/chosen.css">
</head>
<body>
<div style="margin-bottom:10px;display: inline-block;">
<div class="here">
<select data-placeholder="choose Team" class="chosen-select" id="abcd">
<option value=""></option>
@sudhir600
sudhir600 / camelCase.js
Created May 29, 2019 — forked from johnsmith17th/camelCase.js
To convert string to camel case in javascript.
View camelCase.js
function toCamelCase(str) {
return str.toLowerCase().replace(/(?:(^.)|(\s+.))/g, function(match) {
return match.charAt(match.length-1).toUpperCase();
});
}
@sudhir600
sudhir600 / nuxt.config.js
Last active Feb 22, 2019
add settings.js in middleware
View nuxt.config.js
module.exports = {
mode: 'spa',
router: {
middleware: ['settings']
},
...
@sudhir600
sudhir600 / settings.js
Last active Feb 22, 2019
global settings in nuxt vuejs
View settings.js
global.$s = require('../settings.json')
if(!process.server){
Object.defineProperty(Vue.prototype, '$s', { value: $s })
}
#uses
/*created(){
var a = $s['key']
}
or in html
View get and set from localStorage
<html><head>
<link rel="stylesheet" type="text/css" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<style type="text/css">
.wrp{
margin:20px;
padding:10px
}
body{
background-color: transparent;
}
@sudhir600
sudhir600 / set-custom-domain-on-localhost-with-xampp
Last active Oct 13, 2018 — forked from omarusman/custom-domain-localhost-xampp
How to add a custom domain name on your localhost using XAMPP. Codes are based on Windows, but Step 2 onward are pretty much applicable on other operating system.
View set-custom-domain-on-localhost-with-xampp
Step 1:
Go to: C:\Windows\System32\Drivers\etc\hosts
And add this to the bottom of the file:
=============
127.0.0.1 your.domain.com
=============
Step 2:
Go to [your XAMPP directory]/apache/conf/httpd-xampp.conf
View php mail function
<?php
error_reporting(E_ALL);
$from = 'sudhirgupta.456@gmail.com';
$headers = "MIME-Version: 1.0" . PHP_EOL;
$headers .= "Content-Type: text/html; charset=UTF-8" . PHP_EOL;
$headers .= "From: " . $from . "\r\n";
$headers .= "Reply-To: " . $from . "\r\n";
$headers .= "Return-Path: " . $from . "\r\n";
$headers .= "CC: sudhirgupta500@yahoo.com \r\n";
You can’t perform that action at this time.