Skip to content

Instantly share code, notes, and snippets.

require({
paths: {
jquery: '//code.jquery.com/jquery-2.0.3.min',
lodash: '//cdnjs.cloudflare.com/ajax/libs/lodash.js/2.4.1/lodash',
backbone: '//cdn.jsdelivr.net/backbonejs/1.0.0/backbone-min',
handlebars: '//cdnjs.cloudflare.com/ajax/libs/handlebars.js/1.3.0/handlebars.min',
listjs: '//cdnjs.cloudflare.com/ajax/libs/list.js/1.0.2/list.min'
},
shim: {
define([
'jquery',
'backbone',
'lodash',
'handlebars',
'listjs'
],
function($, Backbone, _, Handlebars, List) {
'use strict';
define([
'backbone',
'lodash'
],
function(Backbone, _) {
'use strict';
/**
* Sheet Model
*/
return Backbone.Model.extend({
@nekman
nekman / jsf.md
Last active June 19, 2020 10:41
Don't use JSF

JSF?!

http://www.thoughtworks.com/radar/#/languages-and-frameworks/683 - ThoughtWorks Technology Radar - January 2014

We continue to see teams run into trouble using JSF -- JavaServer Faces -- and are recommending you avoid this technology. Teams seem to choose JSF because it is a J2EE standard without really evaluating whether the programming model suits them. We think JSF is flawed because it tries to abstract away HTML, CSS and HTTP, exactly the reverse of what modern web frameworks do. JSF, like ASP.NET webforms, attempts to create statefulness on top of the stateless protocol HTTP and ends up causing a whole host of problems involving shared server-side state. We are aware of the improvements in JSF 2.0, but think the model is fundamentally broken. We recommend teams use simple frameworks and embrace and understand web technologies including HTTP, HTML and CSS.


http://www.jfokus.se/jfokus/talks.jsp - Search for JSF... (one hit on why you should leave it)
http://architecture-musings.blo
@nekman
nekman / jquery.attrMatcher.js
Last active January 4, 2016 13:49
jQuery attribute matcher.
/**
* http://plnkr.co/edit/Mou8b94hzmuIVjd7b63w?p=preview
*/
(function(global, factory) {
// CommonJS
if (typeof module === 'object') {
module.exports = factory(require('jquery'));
} else if (typeof global.define === 'function') {
// AMD
define(['jquery'], factory);
<!DOCTYPE html>
<html manifest="appcache.manifest">
<head>
<link rel="stylesheet" href="http://netdna.bootstrapcdn.com/bootstrap/3.0.2/css/bootstrap.min.css" />
<title>Appcache progress</title>
<script>
(function(appCache) {
'use strict';
var handleProgress = function(e) {
// Uppdatera progress...
'use strict';
(function() {
var template = 'http://opendata-download-metfcst.smhi.se/api/category/pmp1g/version/1/geopoint/lat/{{lat}}/lon/{{lon}}/data.json';
function toUrl(coords) {
return template.replace(/{{lat}}/, coords.latitude)
.replace(/{{lon}}/, coords.longitude);
}
/*
* Example of encrypted localstorage with CryptoJS.
* http://codepen.io/anon/pen/aCDHo
*
*/
var EncryptedLocalStorage = (function(global) {
'use strict';
// Constructor
var EncryptedLocalStorage = function(secret) {
/**
* jQuery plugin that can be used as a shortcut
* to stop JS-events from bubbling.
*
* See this stackoverflow post for more information:
* http://stackoverflow.com/questions/18968847/stop-js-event-propagation-on-table-row-click/
*
* Usage:
* - Add the attribute or class "no-bubble" to a element.
* <button no-bubble /> or <button class="no-bubble" />
class Example
{
const int VAGVAL1 = 1;
const int VAGVAL2 = 2;
const int VAGVAL3 = 3;
readonly IDictionary<int, Action> _lookupMap;
public Example() {
_lookupMap = new Dictionary<int, Action>() {