Skip to content

Instantly share code, notes, and snippets.

@lexeek
lexeek / gist:6407850
Created September 1, 2013 22:54 — forked from mcs/gist:4059304
/**
* Creates a log wrapper for browser console. If console.log is defined, it passed the function arguments to it.
* Using this method prevents problems when using console.log directly in IE (at least in version 8).
*/
var logger = function () {
if (console && console.log) {
console.log.call(console, arguments);
}
}
@lexeek
lexeek / app.js
Created September 15, 2013 21:11 — forked from pixelhandler/app.js
var application_root = __dirname,
express = require("express"),
path = require("path"),
mongoose = require('mongoose');
var app = express.createServer();
// database
mongoose.connect('mongodb://localhost/ecomm_database');
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>Untitled</title>
<style>
#example {
background: #f00;
width: 300px;
height: 300px;
/*
Infinite List View
creates <ul> with triggers for infinite scrolling
@author Kevin Jantzer, Blacktone Audio Inc.
@since 2012-11-06
USE - listen for:
//
// Regular Expression for URL validation
//
// Author: Diego Perini
// Updated: 2010/12/05
// License: MIT
//
// Copyright (c) 2010-2013 Diego Perini (http://www.iport.it)
//
// Permission is hereby granted, free of charge, to any person

Install ImageMagick for image conversion:

brew install imagemagick

Install tesseract for OCR:

brew install tesseract --all-languages

Or install without --all-languages and install them manually as needed.

jQuery.placeholder = function() {
$('[placeholder]').focus(function() {
var input = $(this);
if (input.hasClass('placeholder')) {
input.val('');
input.removeClass('placeholder');
}
}).blur(function() {
var input = $(this);
if (input.val() === '') {
select.form-control + .chosen-container.chosen-container-single .chosen-single {
display: block;
width: 100%;
height: 34px;
padding: 6px 12px;
font-size: 14px;
line-height: 1.428571429;
color: #555;
vertical-align: middle;
background-color: #fff;
@lexeek
lexeek / jquery.ui.extension.js
Created October 19, 2014 12:53
jquery ReverseResize Extension
$.ui.plugin.add("resizable", "alsoResizeReverse", {
start: function(event, ui) {
var self = $(this).data("ui-resizable"), o = self.options;
var _store = function(exp) {
$(exp).each(function() {
$(this).data("resizable-alsoresize-reverse", {
width: parseInt($(this).width(), 10), height: parseInt($(this).height(), 10),
@lexeek
lexeek / Jcrop.js
Last active August 29, 2015 14:08
// Resources needed:
// Jcrop - http://deepliquid.com/content/Jcrop.html
// loadImage - https://github.com/blueimp/JavaScript-Load-Image
initJcrop: function (isEdit) {
Page.elems.$photoWrapper.find('img').Jcrop({
onChange: function (coo) {
Page.vars.photoParams = coo;
},
onSelect: function (coo) {