Skip to content

Instantly share code, notes, and snippets.

View rajahu's full-sized avatar
🏠
Working from home

Raja Usman Haider rajahu

🏠
Working from home
View GitHub Profile
@shalvah
shalvah / rpn-parser.js
Last active October 22, 2018 19:21
Tokenize and convert a math expression from infix to postfix in Javascript
function parse(inp){
var outQueue=[];
var opStack=[];
Array.prototype.peek = function() {
return this.slice(-1)[0];
};
var assoc = {
"^" : "right",
@jarednorman
jarednorman / webpack-rails-1.markdown
Last active May 13, 2020 18:24
Webpack with Rails Part 1

Webpack with Rails Part 1

I don't like Sprockets, but it's the easiest and best choice for lots of Ruby on Rails projects. When looking for a better way to manage my JavaScript assets and an improved developer story, my current tool of choice is webpack. While I wish Rails supported drop-in asset pipelines the way that Phoenix does, it's not hard to use webpack with Rails.

@yoavniran
yoavniran / ultimate-ut-cheat-sheet.md
Last active October 1, 2024 17:10
The Ultimate Unit Testing Cheat-sheet For Mocha, Chai, Sinon, and Jest
@pseudosavant
pseudosavant / find-html-tags-regular-expression.js
Last active August 31, 2023 12:42
Javascript Regular Expression for finding HTML tags in a string
const htmlTagRe = /<\/?[^>]+>/gi;
const html = '<span class="error" style="background: none; font-size: 1em;" data-attr=testing123><span disabled class="code">Status text blah blah blah</span> <span class="text">HTTP 500 : Internal Server Error</span></span>';
const plainText = html.replace(htmlTagRe, '');
console.log(plainText); // status text blah blah blah HTTP 500 : Internal Server Error
@joyrexus
joyrexus / README.md
Last active November 5, 2024 14:17 — forked from liamcurry/gist:2597326
Vanilla JS equivalents of jQuery methods

Sans jQuery

Events

// jQuery
$(document).ready(function() {
  // code
})