Skip to content

Instantly share code, notes, and snippets.

View adityamukho's full-sized avatar

Aditya Mukhopadhyay adityamukho

View GitHub Profile
@cowboy
cowboy / awesome.js
Created August 12, 2014 15:18
this code from amazon.com's source is... well, just... what web development is all about
document.write = (function(write){
var override = function() {
if(document.readyState !== "loading") { // document has finished loading - we want to intercept this call to document.write
if (window.ueLogError) {
try {
throw new Error("`document.write` called after page load on the gateway.");
}
catch(e) {
ueLogError(e, { logLevel : 'ERROR', attribution: 'gw-third-party-js' });
}
@facultymatt
facultymatt / mean_stack_research.md
Last active December 20, 2015 10:09
MEAN stack research

Current Strategy

We are attempting to find an existing Node / Mongoose / Express seed as an API starting point for our MEAN projects. We love and have come accustomed to the Genesis Skeleton framework workflow, but it lacks a flexiable API server. Ideally we could incorporate the two and cteate a master starter seed!

Findings:

https://github.com/linnovate/mean/

@cobyism
cobyism / gh-pages-deploy.md
Last active July 2, 2024 13:11
Deploy to `gh-pages` from a `dist` folder on the master branch. Useful for use with [yeoman](http://yeoman.io).

Deploying a subfolder to GitHub Pages

Sometimes you want to have a subdirectory on the master branch be the root directory of a repository’s gh-pages branch. This is useful for things like sites developed with Yeoman, or if you have a Jekyll site contained in the master branch alongside the rest of your code.

For the sake of this example, let’s pretend the subfolder containing your site is named dist.

Step 1

Remove the dist directory from the project’s .gitignore file (it’s ignored by default by Yeoman).

@rgreenjr
rgreenjr / postgres_queries_and_commands.sql
Last active July 3, 2024 11:43
Useful PostgreSQL Queries and Commands
-- show running queries (pre 9.2)
SELECT procpid, age(clock_timestamp(), query_start), usename, current_query
FROM pg_stat_activity
WHERE current_query != '<IDLE>' AND current_query NOT ILIKE '%pg_stat_activity%'
ORDER BY query_start desc;
-- show running queries (9.2)
SELECT pid, age(clock_timestamp(), query_start), usename, query
FROM pg_stat_activity
WHERE query != '<IDLE>' AND query NOT ILIKE '%pg_stat_activity%'
@jboner
jboner / latency.txt
Last active July 3, 2024 14:57
Latency Numbers Every Programmer Should Know
Latency Comparison Numbers (~2012)
----------------------------------
L1 cache reference 0.5 ns
Branch mispredict 5 ns
L2 cache reference 7 ns 14x L1 cache
Mutex lock/unlock 25 ns
Main memory reference 100 ns 20x L2 cache, 200x L1 cache
Compress 1K bytes with Zippy 3,000 ns 3 us
Send 1K bytes over 1 Gbps network 10,000 ns 10 us
Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD
@balupton
balupton / README.md
Last active September 29, 2018 18:31
Responsive layouts in stylus

Responsive layouts in stylus

Why this way?

  1. There is no span1..15 styles, instead your css defines your layout and your html remains semantic and not polluted with display information. As it should be.

  2. The markup is incredibly easy, you specify the wrappers width, and then each columns width in percentages. Every other grid framework I've found is incredibly complicated with this.

  3. It allows you to have the exact same markup, and completely different styles for different devices, resolutions, stylesheets, whatever. As it should be.

@katylava
katylava / git-selective-merge.md
Last active February 27, 2024 10:18
git selective merge

Update 2022: git checkout -p <other-branch> is basically a shortcut for all this.

FYI This was written in 2010, though I guess people still find it useful at least as of 2021. I haven't had to do it ever again, so if it goes out of date I probably won't know.

Example: You have a branch refactor that is quite different from master. You can't merge all of the commits, or even every hunk in any single commit or master will break, but you have made a lot of improvements there that you would like to bring over to master.

Note: This will not preserve the original change authors. Only use if necessary, or if you don't mind losing that information, or if you are only merging your own work.