Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am mlangens on github.
  • I am mlangens (https://keybase.io/mlangens) on keybase.
  • I have a public key ASB_zOGmgAwPgfC42rkZesA8XBFAcLHb9b-dbzXG1CZGFgo

To claim this, I am signing this object:

if(!event){
event = window.event;
}
if(event.stopPropagation){
event.stopPropagation();
}
else {
event.cancelBubble = true;
}
@mlangens
mlangens / gist:5959903
Created July 9, 2013 18:31
updated inputChanger
this.inputChanger = function() {
$(window).on('keydown', function(event) {
if(event.which === 13) {
var target = $(event.target);
var thingie = target.closest('.lightbox-container');
var inputs = thingie.find('input,textarea');
var index = inputs.get().indexOf(event.target);
if (index === -1) {
target.click();
} else {
this.inputChanger = function() {
$(window).on('keydown', function(event) {
if(event.which === 13) {
var target = $(event.target);
var thingie = target.closest('.lightbox-container');
var inputs = thingie.find('input,textarea,button');
var index = inputs.get().indexOf(event.target);
// var nextIndex = (index + 1) % inputs.length;
var nextIndex = (index + 1)
if(nextIndex == inputs.length) {
@mlangens
mlangens / gist:5954449
Created July 9, 2013 03:22
wrap around box changer
this.inputChanger = function() {
$(window).on('keydown', function(event) {
if(event.which === 13) {
var target = $(event.target);
var thingie = target.closest('.lightbox-container');
var inputs = thingie.find('input,textarea');
var index = inputs.get().indexOf(event.target);
var nextIndex = (index + 1) % inputs.length;
$(inputs.get(nextIndex)).focus();
return false;
<html>
<head>
<script type="text/javascript" src="jquery-1.8.2.min.js"></script>
<script>
var sampleRate = 44100;
var beatsPerMin = 180;
var ticksPerBeat = 4;
function applyEnvelope(data, a, d, s, r) {
@Test
public void updateCustomCategoryShouldUpdateWithNoDuplicates() throws Exception {
long categoryId = 123L;
String categoryName = "new name";
CustomCategory category1 = new CustomCategory();
category1.setId(categoryId);
category1.setCategoryName("previous name");
CustomCategory category2 = new CustomCategory();
@mlangens
mlangens / gist:2763638
Created May 21, 2012 18:04
modular backbone view
Modularizing a Backbone View
Backbone views most usually always interact with the DOM, using our new modular system we can load in Javascript templates using Require.js text! plugin.
// Filename: views/project/list
define([
'jQuery',
'Underscore',
'Backbone',
// Using the Require.js text! plugin, we are loaded raw text
// which will be used as our views primary template
@mlangens
mlangens / gist:2762862
Created May 21, 2012 15:15
jquery $.get
Backbone.View.extend({
template: 'my-view-template',
render: function(){
var that = this;
$.get("/templates/" + this.template + ".html", function(template){
var html = $(template).tmpl();
that.$el.html(html);
});
return this;
@mlangens
mlangens / nate.js
Created May 18, 2012 17:56
dear nate I got this working thank you for reading ok thx
require([ "order!jquery-1.7.1.min", "order!underscore", "order!backbone",
"order!handlebars-1.0.0.beta.6", "order!navbar", "order!footer",
"order!about", "order!agile_resources",
"order!application_development", "order!apply_now", "order!books",
"order!careers", "order!contact", "order!learn",
"order!current_openings", "order!electronic_card_wall", "order!events",
"order!executive_bios", "order!home", "order!modernization",
"order!services", "order!testimonials", "order!training",
"order!transformation", "order!webinars", "order!whitepapers",
"order!views/views", "order!controllers/routes", "order!contentflow" ],