Skip to content

Instantly share code, notes, and snippets.

View deepak-vasalamarri's full-sized avatar
❤️

Deepak Vasalamarri deepak-vasalamarri

❤️
  • Hyderabad, India
View GitHub Profile
I was searching for a best way to define a javascript class, and then, I found this:
http://www.phpied.com/3-ways-to-define-a-javascript-class/
So, it describes three ways:
1. using a function
2. using JSON
3. singleton (combination of 1. and 2.)
I couldn't find any article which describes what is the best way, in matter of compression, so I decided to test it by myself.
So I made three versions of my navigation system (I already had it in 2. way before I read that article), and I compressed them using google closure compiler, and these are result:
@fxsjy
fxsjy / gist:3291755
Last active January 9, 2021 16:12
Memcached in JavaScript based on Node.JS
//author: Sun, Junyi (weibo.com/treapdb)
//usage: node --nouse-idle-notification --expose-gc --max-old-space-size=8192 memcached.js
var config ={
port: 11211,
max_memory: 300 // default 100M bytes
}
var net = require('net');
var LRU = function (max) { // this LRU implementaion is based on https://github.com/chriso/lru
@desandro
desandro / require-js-discussion.md
Created January 31, 2013 20:26
Can you help me understand the benefit of require.js?

I'm having trouble understanding the benefit of require.js. Can you help me out? I imagine other developers have a similar interest.

From Require.js - Why AMD:

The AMD format comes from wanting a module format that was better than today's "write a bunch of script tags with implicit dependencies that you have to manually order"

I don't quite understand why this methodology is so bad. The difficult part is that you have to manually order dependencies. But the benefit is that you don't have an additional layer of abstraction.


@djangofan
djangofan / endorsedmethod.java
Last active January 6, 2023 22:05
Exercise on safely waiting for unstable web elements with WebDriver.
// This is the official Selenium documention endorsed method of waiting for elements.
// This method is ineffective because it still suffers from
// the stale element exception.
public static void clickByLocator ( final By locator ) {
WebElement myDynamicElement = ( new WebDriverWait(driver, 10))
.until( ExpectedConditions.presenceOfElementLocated( locator ) );
myDynamicElement.click();
}
@tsiege
tsiege / The Technical Interview Cheat Sheet.md
Last active June 12, 2024 03:08
This is my technical interview cheat sheet. Feel free to fork it or do whatever you want with it. PLEASE let me know if there are any errors or if anything crucial is missing. I will add more links soon.

ANNOUNCEMENT

I have moved this over to the Tech Interview Cheat Sheet Repo and has been expanded and even has code challenges you can run and practice against!






\

@staltz
staltz / introrx.md
Last active June 26, 2024 10:24
The introduction to Reactive Programming you've been missing
@JT5D
JT5D / gist:a2fdfefa80124a06f5a9
Last active June 10, 2024 07:25
Google translate language codes
Eg. URL translating en page to es
http://translate.google.com/translate?hl=en&sl=en&tl=es&u=http://about.com
Define the web interface language to be English by adding
hl=en to the end of the URL and after the change the URL will look
like this:
http://www.google.com/search?hl=en
When you use more than one setting code in the URL, you need to use
@ericelliott
ericelliott / essential-javascript-links.md
Last active May 17, 2024 03:38
Essential JavaScript Links
@yoavniran
yoavniran / ultimate-ut-cheat-sheet.md
Last active June 23, 2024 21:35
The Ultimate Unit Testing Cheat-sheet For Mocha, Chai, Sinon, and Jest
@paulirish
paulirish / what-forces-layout.md
Last active June 26, 2024 20:47
What forces layout/reflow. The comprehensive list.

What forces layout / reflow

All of the below properties or methods, when requested/called in JavaScript, will trigger the browser to synchronously calculate the style and layout*. This is also called reflow or layout thrashing, and is common performance bottleneck.

Generally, all APIs that synchronously provide layout metrics will trigger forced reflow / layout. Read on for additional cases and details.

Element APIs

Getting box metrics
  • elem.offsetLeft, elem.offsetTop, elem.offsetWidth, elem.offsetHeight, elem.offsetParent