Skip to content

Instantly share code, notes, and snippets.

View jobyjoseph's full-sized avatar
🏄‍♂️
Trying to be conscious

Joby Joseph jobyjoseph

🏄‍♂️
Trying to be conscious
  • Litmus7 Systems Consulting
  • India
View GitHub Profile
// to make string uppercase
"hello".toUpperCase(); // "HELLO"
console.log("Hello from Webpack");
const path = require("path");
module.exports = {
entry: "./src/index.js",
output: {
filename: "bundle.js",
path: path.resolve(__dirname, "dist")
},
mode: "development"
};
@jobyjoseph
jobyjoseph / setTextboxCursorAtEnd.js
Last active November 26, 2015 06:14
SetCaretAtEnd function accepts a javascript dom object and sets cursor to end.
function SetCaretAtEnd(elem) {
var elemLen = elem.value.length;
// For IE Only
if (document.selection) {
// Set focus
elem.focus();
// Use IE Ranges
var oSel = document.selection.createRange();
// Reset position to 0 & then set at end
oSel.moveStart('character', -elemLen);
@jobyjoseph
jobyjoseph / textboxrangeselector.js
Last active November 26, 2015 06:00
jQuery function to select a range of text inside textarea or textbox
$.fn.selectRange = function (start, end) {
return this.each(function () {
if (this.setSelectionRange) {
this.focus();
this.setSelectionRange(start, end);
} else if (this.createTextRange) {
var range = this.createTextRange();
range.collapse(true);
range.moveEnd('character', end);
range.moveStart('character', start);