Skip to content

Instantly share code, notes, and snippets.

View anish2690's full-sized avatar

Anish George anish2690

View GitHub Profile
@anish2690
anish2690 / UploadToCloudinary.swift
Created October 18, 2017 09:47
Cloudinary Code to Upload PDF,DOC,DOCX,XLS etc Swift
let params = CLDUploadRequestParams()
//params.setRawConvert("illegal") // this is producing some error as illegal is not a valid argument
params.setResourceType(.auto)
cloudinary.createUploader().upload(url: documentUrl, uploadPreset: "wyfi3884", params: params,completionHandler: { (response, error) in
urlCloudinary = response?.url
resp = response
error = error
})
<table class="c6668" style="box-sizing: border-box; height: 150px; margin: 0 auto 10px auto; padding: 5px 5px 5px 5px; width: 100%; max-width: 550px; background-color: #f5f5f5;" width="100%" height="150" bgcolor="#f5f5f5">
<tbody style="box-sizing: border-box;">
<tr style="box-sizing: border-box;">
<td class="c6692" style="box-sizing: border-box; font-size: 12px; font-weight: 300; vertical-align: top; color: rgb(111, 119, 125); margin: 0; padding: 0;" valign="top">
<table class="c6941" style="box-sizing: border-box; height: 80px; margin: 0 auto 10px auto; padding: 5px 5px 5px 5px; width: 100%;" width="100%" height="80">
<tbody style="box-sizing: border-box;">
<tr style="box-sizing: border-box;">
<td class="c6965" style="box-sizing: border-box; font-size: 12px; font-weight: 300; vertical-align: top; color: rgb(111, 119, 125); margin: 0; padding: 0; width: 20%; text-align: center;" width="20%" valign="top" align="center">
<img src="https://
// manage assets pre render
render: {
bundleRenderer: {
shouldPreload: (file, type) => {
return ['script', 'style', 'font'].includes(type)
}
}
}
// use custom loader
<table width="100%" height="150" class="c2555 c11896 c1366 c16344" style="box-sizing: border-box; height: 150px; margin-top: 0px; margin-right: auto; margin-bottom: 10px; margin-left: auto; padding-top: 5px; padding-right: 5px; padding-bottom: 5px; padding-left: 5px; width: 100%; overflow-wrap: break-word; hyphens: auto; max-width: 550px;">
<tbody class="c11905 c1376 c16355" style="box-sizing: border-box;">
<tr class="c11913 c1385 c16365" style="box-sizing: border-box;">
<td valign="top" class="c2579 c11921 c1394 c16375" style="box-sizing: border-box; font-size: 12px; font-weight: 300; vertical-align: top; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; overflow-wrap: break-word; hyphens: auto;">
<div class="c2730 customText c11929 c1403 c16385" style="box-sizing: border-box; padding-top: 10px; padding-right: 10px; padding-bottom: 10px; padding-left: 10px; font-size: 17px; font-family: H
@anish2690
anish2690 / grapesjs_json_export.js
Created October 28, 2019 07:02
save grapesjs data as json and load data as json
var editor = grapesjs.init
({
height: '100%',
fromElement: 1,
clearOnRender: true,
container : '#gjs',
plugins: ['gjs-preset-newsletter'],
storageManager: {
autosave: false,
setStepsBeforeSave: 1,
@anish2690
anish2690 / memorySizeOfObject.js
Created November 8, 2019 18:23
calculate memory size of javascript object, it is not a accurate value!
function memorySizeOf(obj) {
var bytes = 0;
function sizeOf(obj) {
if(obj !== null && obj !== undefined) {
switch(typeof obj) {
case 'number':
bytes += 8;
break;
case 'string':
@anish2690
anish2690 / js.js
Created November 8, 2019 18:30 — forked from capfsb/js.js
js.js
var recognition = new (window.SpeechRecognition || window.webkitSpeechRecognition || window.mozSpeechRecognition || window.msSpeechRecognition)();
recognition.lang = 'en-US';
recognition.interimResults = false;
recognition.maxAlternatives = 5;
recognition.start();
recognition.onresult = function(event) {
console.log('You said: ', event);
};
@anish2690
anish2690 / docker-destroy-all.sh
Created May 15, 2020 04:31 — forked from JeffBelback/docker-destroy-all.sh
Destroy all Docker Containers and Images
#!/bin/bash
# Stop all containers
containers=`docker ps -a -q`
if [ -n "$containers" ] ; then
docker stop $containers
fi
# Delete all containers
containers=`docker ps -a -q`
if [ -n "$containers" ]; then
docker rm -f -v $containers
@anish2690
anish2690 / object_defineProperty_vuejs.js
Created May 23, 2020 19:28
We would normally set an object property like this:
import moment from 'moment';
Object.defineProperty(Vue.prototype, '$moment', { value: moment });
@anish2690
anish2690 / object_defineProperty_vuejs.js
Created May 23, 2020 19:31
Assign some random thing to the instance method
import moment from 'moment';
Object.defineProperty(Vue.prototype, '$moment', { value: moment });
/*it gives us a distinct advantage: properties created with a descriptor are read-only by default.
Instead, our read-only instance method protects our library, and if you attempt to overwrite it you will get "TypeError: Cannot assign to read only property".*/
/*
We would normally set an object property like this:
Vue.prototype.$moment = moment; */