Latest 100 public snipts »
lenni's
snipts
showing 1-16 of 16 snipts
-
∞ JSP & HTML5 template
<?xml version="1.0" encoding="UTF-8"?> <jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" xmlns:c="http://java.sun.com/jsp/jstl/core" xmlns:fmt="http://java.sun.com/jsp/jstl/fmt" xmlns="http://www.w3.org/1999/xhtml" version="2.0"> <jsp:directive.page contentType="text/html" pageEncoding="UTF-8"/> <![CDATA[<!DOCTYPE html>]]> <html lang="de"> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8"/> <title>Neopay Init-Antwort</title> <link rel="stylesheet" type="text/css" href="http://www.blueprintcss.org/blueprint/src/typography.css"/> <link rel="stylesheet" type="text/css" href="http://www.blueprintcss.org/blueprint/src/forms.css"/> <link rel="stylesheet" type="text/css" href="http://www.blueprintcss.org/blueprint/src/grid.css"/> </head> <body> <div class="container"> </div> </body> </html> </jsp:root>
-
∞ JSP Page template
<?xml version="1.0" encoding="UTF-8"?> <jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" xmlns:c="http://java.sun.com/jsp/jstl/core" xmlns:fmt="http://java.sun.com/jsp/jstl/fmt" xmlns:jb="http://www.mytoys.de/jbacca" xmlns="http://www.w3.org/1999/xhtml" version="2.0"> <jsp:directive.page contentType="text/html" pageEncoding="UTF-8"/> <script text="text/javascript"> window.open('schritt1.jsp','mywin', 'left=20,top=20,width=500,height=500,toolbar=1,resizable=0'); </script> </jsp:root>
-
∞ Installing setuptools
./python -c "import urllib; urllib.main()" \ http://peak.telecommunity.com/dist/ez_setup.py \ | ./python - -U setuptools
-
∞ Getting a logger with Log4j
private static final Log LOG = LogFactory.getLog(SomeClassName.class);
-
∞ tar cheat sheet
#extract tar file (uncompressd) tar xf filename.tar #extract gzip'ed tar file (tar.gz) tar xvfz filename.tar.gz #extract tar into specified folder tar -xf compassindex-201004131433.tar -C 201004131433/ #compress a directory into a tar.gz tar -pczf stoffbruch.tar.gz stoffbruch/ #extract a .bz2 bunzip2 konsum-error.log.2010-07-31.bz2
-
∞ Running a class inside a jar
java -cp konsumtools.jar de.myToys.konsum.tools.export.Sitemapper
-
∞ ack examples
ack cancelcode --jsp --ignore-dir=target ack \<script --jsp --ignore-dir=target ack \<script --jsp --ignore-dir=target --ignore-dir=jsp --ignore-dir=mtstat
-
∞ JSP if-else
<c:choose> <c:when test='${param.p == "someValue"}'> </c:when> <c:otherwise> </c:otherwise> </c:choose>
-
∞ Print a file line for line in Java (the 1.6 way)
import java.io.BufferedReader; import java.io.FileNotFoundException; import java.io.FileReader; import java.io.IOException; public class SlugTester { static String FILENAME = "C:\\slug-test.txt"; public static void main(String[] args) { try { BufferedReader reader = new BufferedReader(new FileReader(FILENAME)); String line; while ((line = reader.readLine()) != null) { System.out.println(line); } } catch (FileNotFoundException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } } }
-
∞ Java regex tester
import java.util.regex.Matcher; import java.util.regex.Pattern; public class RegexTester { /** * @param args */ public static void main(String[] args) { // TODO Auto-generated method stub String regex = "/ajax/\\w+/(.*)"; String[] strings = { "/ajax/hello/KID/de-mt.vc.ca02.06.04/1559286", "/ajax/hell_o/KID/de-mt.vc.ca02.06.04/1559286", "/ajax/h0e-l8l_o/KID/de-mt.vc.ca02.06.04/1559286", }; for (String s : strings) { Pattern pattern = Pattern.compile(regex); Matcher matcher = pattern.matcher(s); String kid = ""; if (matcher.find()) { // group(0) returns the entire match, not a captured group kid = matcher.group(1); } System.out.println(kid); } } }
-
∞ jQuery HTML template
<!DOCTYPE html> <html lang="en"> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8"> <title>Lektion 7</title> <link rel="stylesheet" type="text/css" href="style.css" /> <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js" type="text/javascript"></script> <script type="text/javascript"> $(document).ready(function(){ }); </script> </head> <body> <h1 id="ueberschrift"></h1> </body> </html>
-
∞ Protoype HTML Page template
<!DOCTYPE html> <html lang="en"> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8"> <title>Lektion 7</title> <link rel="stylesheet" type="text/css" href="style.css" /> <script src="http://ajax.googleapis.com/ajax/libs/prototype/1.6.1.0/prototype.js" type="text/javascript"></script> <script type="text/javascript"> var callback = function(event){ var clickedElement = event.element(); var styleObj = { color:"red" }; clickedElement.setStyle(styleObj); }; var el=$("ueberschrift"); el.observe("click", callback); </script> </head> <body> <h1 id="ueberschrift">Lektion 8: Callbacks mit Prototype</h1> </body> </html>
-
∞ .hgignore & .gitignore template
syntax: glob # build directories and files **/build/* build/* target/**.* #hg syntax target #git syntax dist/**.* *.pyc #Eclipse .settings/*.** .classpath .project # Netbeans nb-configuration.xml nbactions.xml # Backup files left behind by the Emacs editor. *~ # Lock files used by the Emacs editor. .\#* # Temporary files used by the vim editor. .*.swp # Temporary files used by TestMate ._* # XCode user data **.pbxuser **.mode?v? **.perspectivev? # documentation **.docset/* # for those crazies using svn and hg at the same time *.svn* # Random OS stuff .DS_Store Thumbs.db # temporary folders syntax: regexp .*/te?mp/.*
-
∞ Prototype & Scriptacolous template
<!DOCTYPE html> <html lang="en"> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8"> <title>Title Goes Here</title> <link rel="stylesheet" type="text/css" href="style.css" /> <script src="http://ajax.googleapis.com/ajax/libs/prototype/1.6.1.0/prototype.js" type="text/javascript"></script> <script src="http://ajax.googleapis.com/ajax/libs/scriptaculous/1.8.2/scriptaculous.js" type="text/javascript"></script> </head> <body> <p>This is my web page</p> </body> </html>
-
∞ HTML5 template
<!DOCTYPE html> <html lang="en"> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8"/> <title>Title Goes Here</title> <link rel="stylesheet" type="text/css" href="style.css" /> </head> <body> <p>This is my web page</p> </body> </html>
-
∞ jsp jbacca template
<?xml version="1.0" encoding="UTF-8"?> <jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" xmlns:c="http://java.sun.com/jsp/jstl/core" xmlns:fmt="http://java.sun.com/jsp/jstl/fmt" xmlns:jb="http://www.mytoys.de/jbacca" xmlns="http://www.w3.org/1999/xhtml" version="2.0"> <jsp:directive.tag body-content="scriptless" description="Lädt den Inhalt einer URL herunter und fügt sie in die Seite ein." example=""/> <jsp:directive.attribute description="Die URL die in das Ajax-Fenster geladen werden soll." name="href" required="false" /> <jb:generateId /> <jb:script> new KONSUM.jbacca.ImageZoom("${jbaccaId}"); </jb:script> </jsp:root>


