Skip to content

Instantly share code, notes, and snippets.

View benjamine's full-sized avatar

Benjamín Eidelman benjamine

View GitHub Profile
@benjamine
benjamine / scrumy-rest-api-sample.js
Created September 2, 2010 02:37
Accessing scrumy.com REST API with jquery
var scrumyname = $.trim($('#scrumyname')[0].value);
var usrpwd64 = base64.encode(scrumyname + ':' + $('#scrumypwd')[0].value);
var currenturl = 'http://scrumy.com/api/scrumies/' + scrumyname + '/sprints/current.json';
alert('accessing ' + currenturl);
$.ajax({
url: currenturl,
beforeSend: function(req) {
req.setRequestHeader("Origin", document.location.protocol + "//" + document.location.host);
req.setRequestHeader("Authorization", "Basic " + usrpwd64);
@benjamine
benjamine / gist:822331
Created February 11, 2011 13:25
JavaScript Koan (liammclennans) step 1
// part of https://github.com/liammclennan/JavaScript-Koans
$(document).ready(function () {
module("About Asserts (topics/about_asserts.js)");
test("ok", function () {
ok(true, 'what will satisfy the ok assertion?');
});
@benjamine
benjamine / runwebservicetest.bat
Created May 9, 2011 16:58
Call WebService with JSON data using MSXML2.ServerXMLHTTP (Windows Script)
Cscript webservicetest.js
pause
@benjamine
benjamine / README.mdown
Created May 30, 2011 16:04 — forked from mathewbyrne/README.mdown
An asynchronous method for embedding gists in an HTML document using jQuery.

A quick jQuery plugin for asynchronously embedding a gist in an HTML document.

There are a couple of ways to use it. The simpler way is replacing all Gist links in document by their embedded version:

<script>$($.gist);</script>

All links that point to a gist, or gist file will be replaced by the corresponding embedded gist, or gist file.

Gist link replacement can also be called on a container element:

@benjamine
benjamine / postMessage.js
Created June 7, 2011 15:04
window.postMessage
this.testData = {
message: 'a random message '+Math.floor(Math.random()*10000),
log: []
};
// test that postMessage is supported
ok(typeof window.postMessage == 'function', 'window.postMessage is supported');
// test posting a message to the same frame
@benjamine
benjamine / suppressnavkeys.js
Created August 4, 2011 13:24
Disable navigation keys for web apps (F5, Backspace)
(function(log) {
var handler = function(evt) {
evt = evt || window.event;
var target = evt.target || evt.srcElement;
// F5, backspace
if ((evt.keyCode == 116) ||
(evt.keyCode == 8 && !/input|textarea/i.test(target.nodeName))
) {
@benjamine
benjamine / gihub-fullwidth.user.js
Last active December 15, 2015 07:19
UserScript/GithubFullWidth
// ==UserScript==
// @name Github Full Width
// @namespace github.responsive.width
// @version 0.1
// @description make github use all your screen
// @include https://github.com/*/blob/*
// @include https://github.com/*/pull/*/files
// @include https://github.com/*/commit/*
// @copyright 2013+, Benjamin Eidelman
// ==/UserScript==
@benjamine
benjamine / README.md
Last active December 9, 2021 22:46
Delete your fork master branch, useful when using feature branches

When working with feature branches, the master branch on your fork becomes useless (you probably base your branches on upstream/master). As a result you fork's master gets outdated, and can lead to mistakes.

Deleting it is a good idea, but github needs a "default branch" to show on website, this script will create an orphan "_default" branch with just an explanatory README.md on it, and set that as default for github (you'll be asked your github password).

DISCLAIMER: This script will delete your master branch locally and remotely, be sure you don't need it anymore before running this!

@benjamine
benjamine / timelinks.js
Last active December 19, 2015 15:59
Turn any text that looks like time to a time link alla youtube. clicking will change url hash, and (if found) a jwplayer to seek to that position
@benjamine
benjamine / alias.cmd
Last active February 19, 2024 15:49
Aliases for windows command line
::
:: Aliases for windows command line
::
:: Installation:
::
:: - create a folder for your aliases (eg: ```c:\cmd-aliases```)
:: - add that folder to your PATH variable
:: - save this script as setalias.cmd on that folder
:: - run "alias" to see usage
::