Skip to content

Instantly share code, notes, and snippets.

@imhotep
imhotep / keybase.md
Created October 8, 2014 06:25
Keybase verification

Keybase proof

I hereby claim:

  • I am imhotep on github.
  • I am anis (https://keybase.io/anis) on keybase.
  • I have a public key whose fingerprint is 18DC 7AF8 7ED9 6526 D588 B624 19BF CA54 9115 8AD4

To claim this, I am signing this object:

RelativeLayout main = new RelativeLayout(cordova.getActivity()); // cordova is CordovaInterface
ViewGroup root = webView.getParent(); // webView is CordovaWebView
root.removeView(webView);
main.addView(webView);
cordova.getActivity().setContentView(main);
function createHashLinks(em) {
for(var i = 0 ; i < em.childNodes.length ; i++) {
var child = em.childNodes[i];
if(child.nodeType == Node.TEXT_NODE) {
var fragment = document.createDocumentFragment();
var strSrc = child.nodeValue;
var hashtags = strSrc.match(/#\w+/);
var cur = 0;
if(hashtags) {
for(var j = 0 ; j < hashtags.length ; j++) {
@imhotep
imhotep / gist:5655884
Created May 27, 2013 08:40
Reverse Linked List
#include <stdio.h>
#include <stdlib.h>
typedef struct List {
int d;
struct List* next;
} List;
List* reverse(List* cur, List* prev) {
if(cur == NULL) return prev;
var a = (function() {
var original_a = a;
if (condition) {
return function() {
new_code();
original_a();
}
}
else {
@imhotep
imhotep / gist:4190733
Created December 2, 2012 19:57
Object.watch
/*
* object.watch v0.0.1: Cross-browser object.watch
*
* By Elijah Grey, http://eligrey.com
*
* A shim that partially implements object.watch and object.unwatch
* in browsers that have accessor support.
*
* Public Domain.
* NO WARRANTY EXPRESSED OR IMPLIED. USE AT YOUR OWN RISK.