Skip to content

Instantly share code, notes, and snippets.

View ikhattab's full-sized avatar
🎮
.

Ihab Khattab ikhattab

🎮
.
View GitHub Profile
@michaelkoper
michaelkoper / backbone_pushstate_router.js
Last active October 5, 2016 21:28 — forked from tbranyen/backbone_pushstate_router.js
hijack links for pushState in Backbone. With open in new tab functionality.
// Use absolute URLs to navigate to anything not in your Router.
var openLinkInTab = false;
// Only need this for pushState enabled browsers
if (Backbone.history && Backbone.history._hasPushState) {
$(document).keydown(function(event) {
if (event.ctrlKey || event.keyCode === 91) {
openLinkInTab = true;
@stuart11n
stuart11n / gist:9628955
Created March 18, 2014 20:34
rename git branch locally and remotely
git branch -m old_branch new_branch # Rename branch locally
git push origin :old_branch # Delete the old branch
git push --set-upstream origin new_branch # Push the new branch, set local branch to track the new remote
@kbav
kbav / snippet-holder_js.sublime-snippet
Last active August 29, 2015 13:58
Sublime Text Holder.js Syntax Snippet
<snippet>
<content><![CDATA[
${1:/js/holder.js/}${2:300}x${3:200}/${4:auto/}${5:sky/vine/lava/gray/industrial/social}/#${6:000000}:#${7:FFFFFF}/text:${8:hello world}
]]></content>
<!-- Optional: Set a tabTrigger to define how to trigger the snippet -->
<tabTrigger>holder_js-snippet</tabTrigger>
<!-- Optional: Set a scope to limit where the snippet will trigger -->
<!-- <scope>source.python</scope> -->
<description>Holder.js syntax helper snippet. Holder.js (https://github.com/imsky/holder) is the best tool for making placeholder images.</description>
</snippet>
@staltz
staltz / introrx.md
Last active August 6, 2026 06:30
The introduction to Reactive Programming you've been missing
@mathisonian
mathisonian / index.md
Last active August 10, 2024 20:59
requiring npm modules in the browser console

demo gif

The final result: require() any module on npm in your browser console with browserify

This article is written to explain how the above gif works in the chrome (and other) browser consoles. A quick disclaimer: this whole thing is a huge hack, it shouldn't be used for anything seriously, and there are probably much better ways of accomplishing the same.

Update: There are much better ways of accomplishing the same, and the script has been updated to use a much simpler method pulling directly from browserify-cdn. See this thread for details: mathisonian/requirify#5

inspiration

@nikcorg
nikcorg / berlin-jsconf-2014.md
Last active August 4, 2023 12:45
Slide decks of JSConf 2014
@cironunes
cironunes / ng-modules.md
Last active May 24, 2016 07:48
A curated list of AngularJS modules and tools
@AhmedSoliman
AhmedSoliman / permutations.scala
Created October 8, 2014 09:24
Generate Permutations of String in Scala
/**
* A question I normally ask in Scala interviews, this is not a tail-recursive implementation
*/
object Permutations {
def permutations(s: String): List[String] = {
def merge(ins: String, c: Char): Seq[String] =
for (i <- 0 to ins.length) yield
ins.substring(0, i) + c + ins.substring(i, ins.length)

Screencapture and animated gifs

I say "animated gif" but in reality I think it's irresponsible to be serving "real" GIF files to people now. You should be serving gfy's, gifv's, webm, mp4s, whatever. They're a fraction of the filesize making it easier for you to deliver high fidelity, full color animation very quickly, especially on bad mobile connections. (But I suppose if you're just doing this for small audiences (like bug reporting), then LICEcap is a good solution).

Capturing (Easy)

  1. Launch quicktime player
  2. do Screen recording

screen shot 2014-10-22 at 11 16 23 am

@ericelliott
ericelliott / essential-javascript-links.md
Last active April 30, 2026 08:09
Essential JavaScript Links