Skip to content

Instantly share code, notes, and snippets.

@NKjoep
NKjoep / jsp-date-manipulation-sample.jsp
Created December 16, 2013 15:48
JSP date manipulation sample: increase time give a date sample...
<%@ page contentType="text/plain; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<%@ taglib prefix="s" uri="/struts-tags" %>
<%@ taglib prefix="wp" uri="/aps-core" %>
<%@ taglib prefix="wpsa" uri="/apsadmin-core" %>
<%@ taglib prefix="wpsf" uri="/apsadmin-form" %>
<c:set var="random"><%= java.lang.Math.round(java.lang.Math.random() * 6) %></c:set>
<c:set var="startDate" value="${param.lastStreamTimestamp}" />
@NKjoep
NKjoep / view-source.bookmarklet
Last active December 16, 2015 19:59
Bookmarklet for quick "view-source". Works with Webkit/FF
javascript: (function () { window.open("view-source:"+window.location.href, '_blank'); })();
@NKjoep
NKjoep / fill-form-bookmarklet.js
Created April 3, 2013 13:18
Bookmarklet: Fill That Form with Random Numbers
javascript: (function () {function fill(input) {if ((input.tagName == 'input' && (input.type != 'hidden' && input.type != 'submit' && input.type != 'image')) || (input.tagName == 'textarea')) {if (input.value == null || input.value.length==0) {input.value = Math.floor(Math.random() * 9999999)}}}var inputs = document.getElementsByTagName("input");for (var i = 0; i < inputs.length; i++) {fill(inputs[i]);}var inputs = document.getElementsByTagName("textarea");for (var i = 0; i < inputs.length; i++) {fill(inputs[i]);}})();
@NKjoep
NKjoep / jsp-javascript-escape-sample.jsp
Last active November 18, 2015 22:15
JSP javascript escape with JSTL
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<%-- setup --%>
<% pageContext.setAttribute("carriageReturn", "\r"); %>
<% pageContext.setAttribute("newLine", "\n"); %>
<c:set var="singleQuotes">'</c:set>
<c:set var="singleQuotesReplace">\'</c:set>
<c:set var="doubleQuotes">"</c:set>
<c:set var="doubleQuotesReplace">\"</c:set>
@NKjoep
NKjoep / devdocs.io-bookmarklet.js
Last active November 16, 2015 13:50
devdocs.io preferred bookmarklet activator
javascript: (function(){
[
"angular",
"bower",
"css",
"django",
"dom",
"dom_events",
"ember",
"express",
@NKjoep
NKjoep / angular-list-models.html
Created November 13, 2015 14:16
angular list models
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Input Sample</title>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.5/css/bootstrap.css">
<script src="http://cdnjs.cloudflare.com/ajax/libs/angular.js/1.2.1/angular.js"></script>
@NKjoep
NKjoep / Entando-wp18n.sublime-snippet
Created November 8, 2012 09:41
Sublime Text 2 Snippets Collection
<snippet>
<content><![CDATA[
-- DELETE FROM localstrings where keycode = '${1:keycode}';
INSERT INTO localstrings(keycode, langcode, stringvalue) VALUES ('${1:keycode}','en','${2:en_value}');
INSERT INTO localstrings(keycode, langcode, stringvalue) VALUES ('${1:keycode}','it','${3:it_value}');
-- <wp:i18n key="${1:keycode}" escapeXml="true" />
${4}
]]></content>
</snippet>
@NKjoep
NKjoep / adminadmin-scriptlet.js
Created March 7, 2012 14:12
browser scriptlet for quick adminadminamdin
javascript:(function(){var%20inputs%20=%20document.getElementsByTagName("input");%20for%20(var%20i%20=%200;i<inputs.length;i++)%20{%20var%20c%20=%20inputs[i];%20if%20(c.name=="username")%20c.value%20=%20"admin";%20if%20(c.name=="password")%20c.value%20=%20"adminadmin";%20}%20})();
@NKjoep
NKjoep / entando-headinfo-jsp-fragment.jsp
Created September 15, 2011 14:01
Entando Pagemodel Headinfo
<%@ taglib prefix="wp" uri="aps-core.tld" %>
<%-- css --%>
<wp:outputHeadInfo type="CSS">
<link rel="stylesheet" type="text/css" href="<wp:cssURL /><wp:printHeadInfo />" />
</wp:outputHeadInfo>
<%-- css for ie7 --%>
<wp:outputHeadInfo type="CSS_IE7">
<!--[if IE 7]>
<link rel="stylesheet" type="text/css" href="<wp:cssURL /><wp:printHeadInfo />" />
@NKjoep
NKjoep / console.log.reg
Created May 6, 2011 10:06
Fast RegExp which find and replace all console.log( occurences in your code and comment them out.
//find this
(^.*[^//])console.log
//replace with
$1//console.log