Instantly share code, notes, and snippets.

@yamsellem
yamsellem / webpack.config.js
Last active Mar 8, 2018
Environment variables
View webpack.config.js
var webpack = require('webpack');
var path = require('path');
var LiveReloadPlugin = require('webpack-livereload-plugin');
var BUILD_DIR = path.resolve(__dirname, 'assets/built');
var APP_DIR = path.resolve(__dirname, 'assets/js');
let variables = {};
if (process.env.NODE_ENV === 'production') {
variables = { // could be a file
View Config
// package.json
{
"name": "backbone.training",
"version": "0.0.1",
"repository": {
"type": "git",
"url": ""
},
"scripts": {
View app.js
"use strict";
$(function() {
$('a').on('click', function(e) {
e.preventDefault();
Backbone.history.navigate(
$(e.currentTarget).attr('href'),
{trigger: true}
);
});
@yamsellem
yamsellem / Key Bindings - User
Created Nov 25, 2014
Sublime Text 2 - Preferences
View Key Bindings - User
[{
"keys": ["command+b"], "command": "reveal_in_side_bar"
}]
@yamsellem
yamsellem / index.html
Created Jun 28, 2014
Backbone meetup S01E2 — Stickit
View index.html
<!doctype html>
<html class="no-js" lang="en">
<head>
<meta charset="utf-8"/>
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
<link rel="shortcut icon" href="css/img/favicon.png">
<title>This Meetup, Stickit ;-)</title>
<link rel="stylesheet" href="vendor/foundation/css/foundation.css"/>
<link rel="stylesheet" href="css/meetup.css"/>
@yamsellem
yamsellem / JongoJacksonMapperProvider
Created Jul 21, 2012
Jongo Jackson provider to make Jersey serves ObjectId as String
View JongoJacksonMapperProvider
import static org.codehaus.jackson.annotate.JsonAutoDetect.Visibility.ANY;
import static org.codehaus.jackson.map.DeserializationConfig.Feature.AUTO_DETECT_SETTERS;
import static org.codehaus.jackson.map.DeserializationConfig.Feature.FAIL_ON_UNKNOWN_PROPERTIES;
import static org.codehaus.jackson.map.SerializationConfig.Feature.AUTO_DETECT_GETTERS;
import static org.codehaus.jackson.map.annotate.JsonSerialize.Inclusion.NON_DEFAULT;
import java.io.IOException;
import javax.ws.rs.ext.ContextResolver;
import javax.ws.rs.ext.Provider;