Skip to content

Instantly share code, notes, and snippets.

View kk3399's full-sized avatar
💭
glorified typist

Krishna Damarla kk3399

💭
glorified typist
View GitHub Profile
Text editor
2D game - Space Invaders
Compiler - Tiny BASIC
Mini operating system
Spreadsheet (hard!)
Video game console emulator (hard!)
Database from scratch
Ray tracer
MS Paint clone
Vector graphics editor
@kk3399
kk3399 / preprocessor_fun.h
Last active August 29, 2015 14:27 — forked from aras-p/preprocessor_fun.h
Things to commit just before leaving your job
// Just before switching jobs:
// Add one of these.
// Preferably into the same commit where you do a large merge.
//
// This started as a tweet with a joke of "C++ pro-tip: #define private public",
// and then it quickly escalated into more and more evil suggestions.
// I've tried to capture interesting suggestions here.
//
// Contributors: @r2d2rigo, @joeldevahl, @msinilo, @_Humus_,
// @YuriyODonnell, @rygorous, @cmuratori, @mike_acton, @grumpygiant,
@kk3399
kk3399 / output.log
Last active August 29, 2015 14:27 — forked from creationix/output.log
Working version of generator async code sample. Using node from https://github.com/andywingo/node/tree/v8-3.19
tim@touchsmart:~/Code$ nvm use v0.11.2-generators
Now using node v0.11.2-generators
tim@touchsmart:~/Code$ node --harmony testgen.js
<Buffer 76 61 72 20 66 73 20 3d 20 72 65 71 75 69 72 65 28 27 66 73 27 29 3b 0a 66 75 6e 63 74 69 6f 6e 20 72 65 61 64 46 69 6c 65 28 70 61 74 68 2c 20 65 6e 63 ...>
Sleeping for 2000ms...
Done
<body>
The text
<!-- A comment -->
<script>
//return;
function AttachEvents(target)
{
target.addEventListener('beforescriptexecute', log('beforescriptexecute'))
target.addEventListener('afterscriptexecute', log('afterscriptexecute'))
}
@kk3399
kk3399 / test.html
Last active August 29, 2015 14:15
JS Playground
<!DOCTYPE html>
<html lang="en" class="no-js">
<head>
<title>Test</title>
</head>
<body>
<a href='http://stackoverflow.com/questions/17118956/clarifying-javascript-prototype-nomenclature-and-mechanism'> Abt JS prototype vs constructor inheritance</a>
@kk3399
kk3399 / Gits
Last active August 29, 2015 14:15
Gits
//locally tracked branches
git branch -vv
git branch -l
//list all branches
git branch -a
//list remote branches
git branch -r
@kk3399
kk3399 / README.md
Last active August 29, 2015 14:15 — forked from evandrix/README.md

Here are a list of headless browsers that I know about:

  • [HtmlUnit][1] - Java. Custom browser engine. JavaScript support/DOM emulated. Open source.
  • [Ghost][2] - Python only. WebKit-based. Full JavaScript support. Open source.
  • [Twill][3] - Python/command line. Custom browser engine. No JavaScript. Open source.
  • [PhantomJS][4] - Command line/all platforms. WebKit-based. Full JavaScript support. Open source.
  • [Awesomium][5] - C++/.Net/all platforms. Chromium-based. Full JavaScript support. Commercial/free.
  • [SimpleBrowser][6] - .Net 4/C#. Custom browser engine. No JavaScript support. Open source.
  • [ZombieJS][7] - Node.js. Custom browser engine. JavaScript support/emulated DOM. Open source.
  • [EnvJS][8] - JavaScript via Java/Rhino. Custom browser engine. JavaScript support/emulated DOM. Open source.

Names always based on what they do, not why, where or how

  • eg not Url2Png but Screenshot or ScreenshotTaker
  • eg not twitter_user_image_tag but user_image_tag

Git commits always why you did it - not what you did

  • eg not Update Gemfile but Security Update for Rails 4.1.1

Think of git commits as titles for blogposts

<script type="text/javascript">
(function () {
"use strict";
// once cached, the css file is stored on the client forever unless
// the URL below is changed. Any change will invalidate the cache
var css_href = './index_files/web-fonts.css';
// a simple event handler wrapper
function on(el, ev, callback) {
if (el.addEventListener) {
el.addEventListener(ev, callback, false);
// # Mocha Guide to Testing
// Objective is to explain describe(), it(), and before()/etc hooks
// 1. `describe()` is merely for grouping, which you can nest as deep
// 2. `it()` is a test case
// 3. `before()`, `beforeEach()`, `after()`, `afterEach()` are hooks to run
// before/after first/each it() or describe().
//
// Which means, `before()` is run before first it()/describe()