Skip to content

Instantly share code, notes, and snippets.

View mkmms's full-sized avatar

Mohankumar mkmms

  • Bangalore, India
View GitHub Profile
@mkmms
mkmms / generateParam.ext.js
Created August 29, 2019 11:08
jQuery get params from any parent element
$.fn.generateParams = function() {
var rsubmittable = /^(?:input|select|textarea|keygen)/i;
var rcheckableType = ( /^(?:checkbox|radio)$/i );
var rCRLF = /\r?\n/g;
return this
.find("input, select, textarea, keygen")
.not(":disabled")
.filter(function(){
var type = this.type;
@mkmms
mkmms / vue.config.js
Created June 25, 2019 11:58
Vue.config.js to enable hot module reload in external server like Rails
//make sure the rails server domain name and vue cli publicPath, devServer.host should be the same
module.exports = {
"outputDir": `${process.env.OUTPUT_PATH}`,
"filenameHashing": false,
devServer: {
headers: {
"Access-Control-Allow-Origin": "\*"
},
host: process.env.PUBLIC_URL,
port: process.env.PORT,
>> Rack::HTTP_STATUS_CODES
{100=>"Continue",
101=>"Switching Protocols",
102=>"Processing",
200=>"OK",
201=>"Created",
202=>"Accepted",
203=>"Non-Authoritative Information",
204=>"No Content",
#model
validates_uniqueness_of :slug
validates_presence_of :slug
before_save :check_slug
def check_slug
self.slug = self.slug.downcase.strip.gsub(' ', '-').gsub(/[^\w-]/, '')
end
ERROR: Database files are locked. Daemon already running? Warning: Unable to start the server. Please restart MySQL and run mysql_upgrade to ensure the database is ready for use. site:www.digitalocean.com
An easy solution is to ```sudo killall mysqld``` while the apt-get operation is running.
# ps aux | grep mysql
# sudo kill #{process}
@mkmms
mkmms / nuxt.config.js
Last active August 19, 2019 15:37
@nuxt/apollo Cors Issue Apollo config
apollo: {
clientConfigs: {
default: {
httpEndpoint: `${process.env.API_URL}/graphql`,
httpLinkOptions: {
fetchOptions: {
mode: 'cors' //Cors Needed for external Cross origins, need to allow headers from server
},
credentials: "omit" //must be omit to support application/json content type
}
@mkmms
mkmms / gist:f0e35e93fc43da129ef99539342a9f81
Created December 26, 2018 12:54 — forked from jeffrafter/gist:1328625
Local nginx proxy to rails s
worker_processes 1;
error_log /usr/local/var/log/nginx.error.log;
events {
worker_connections 1024;
}
http {
include mime.types;