Skip to content

Instantly share code, notes, and snippets.

#include <stdio.h>
#include <time.h>
#include <stdlib.h>
#include <linux/sched.h>
#include <linux/kernel.h>
#include "../../RW_sem.h"
typedef struct q_node
{

Keybase proof

I hereby claim:

  • I am matthewmorrone1 on github.
  • I am matthewmorrone (https://keybase.io/matthewmorrone) on keybase.
  • I have a public key whose fingerprint is 1B41 AF40 2D73 B847 F06A D416 6032 CA4C AE47 6010

To claim this, I am signing this object:

@matthewmorrone
matthewmorrone / left-right.js
Last active August 29, 2015 14:10
Keyboard Nav for Learning Portal
if (!($ instanceof jQuery)) {
var jq = document.createElement('script');
jq.src = "https://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js";
document.getElementsByTagName('head')[0].appendChild(jq);
}
$(document).keydown(function(e) {if (e.which !== 39) {return;}; $("#lnkNext").click();});
$(document).keydown(function(e) {if (e.which !== 37) {return;}; $("#lnkPrevious").click();});
define(Object.prototype, "define", {
enumerable: false,
configurable: true,
writable: true,
value: function(key, value) {
Object.defineProperty(Object.prototype, key, {
enumerable: false,
value: value
});
}
Array.prototype.define("swap", function(a, b) {
// this[a] = this.splice(b, 1, this[a])[0]; // slower but prettier
var tmp = this[a];
this[a] = this[b];
this[b] = tmp;
return this;
});
@matthewmorrone
matthewmorrone / window.setInterval.js
Created December 6, 2014 23:28
I always forget the order of arguments for setInterval and setTimeout
if (window.nativeSetInterval) {
window.setInterval = window.nativeSetInterval;
delete window.nativeSetInterval;
}
// requires object.define.js, arguments.js, array.swap.js, log.js
window.define("nativeSetInterval", setInterval);
window.define("setInterval", function() {
if (typeof arguments[0] === "number") {
@matthewmorrone
matthewmorrone / log.js
Created December 6, 2014 23:30
"console.log" is way too long to be typing all the time
var log = console.log.bind(console);
/*
alternatively:
log = console.log.bind(console);
window.log = console.log.bind(console);
*/
@matthewmorrone
matthewmorrone / jquery.on.js
Last active August 29, 2015 14:10
This is an attempt to make jQuery's event helper functions use the "live" or "delegate" implementation of the on function, so that you don't have to run your event handler creators again if/when you add more elements.
$.each(("blur focus focusin focusout load resize scroll unload click dblclick " +
"mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " +
"change select submit keydown keypress keyup error contextmenu").split(" "),
function(i, name)
{
$.fn[name] = function(fn) {
return arguments.length > 0 ?
$(document).on(name, this, fn) :
this.trigger(name);
};
@matthewmorrone
matthewmorrone / jquery.dblToggle.js
Last active August 29, 2015 14:10
All my friends are deprecated =[
$.fn.extend({
toggle: function (fn) {
var args = arguments,
guid = fn.guid || $.guid++,
i = 0,
toggler = function (event) {
var lastToggle = ($._data(this, "lastToggle" + fn.guid) || 0) % i;
$._data(this, "lastToggle" + fn.guid, lastToggle + 1);
event.preventDefault();
return args[lastToggle].apply(this, arguments) || false;
@matthewmorrone
matthewmorrone / jquery.file.js
Created December 6, 2014 23:44
don't judge me
$.file_get_contents = function (addr, split) {
return $.ajax({
url: addr,
async: false
}).responseText;
}
$.file = function(addr) {
return $.file_get_contents(addr).split("\n");
}