This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<link rel="import" href="../core-pages/core-pages.html"> | |
<link rel="import" href="../core-icon-button/core-icon-button.html"> | |
<link rel="import" href="../core-toolbar/core-toolbar.html"> | |
<link rel="import" href="../core-header-panel/core-header-panel.html"> | |
<link rel="import" href="../core-menu/core-submenu.html"> | |
<link rel="import" href="../core-item/core-item.html"> | |
<polymer-element name="my-element"> | |
<template> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.*; | |
import java.text.*; | |
/** | |
* First compile class: c:\java\jdk1.7.0_71\bin\javac.exe DateDemo.java | |
* Secondly run it with: java -cp . DateDemo | |
*/ | |
public class DateDemo { | |
public static void main(String args[]) { | |
final Date dNow = new Date( ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Grab(group='com.ocpsoft', module='ocpsoft-pretty-time', version='1.0.7') | |
import groovy.time.TimeCategory | |
import com.ocpsoft.pretty.time.PrettyTime | |
Date.metaClass.pretty = {it -> | |
def p = new PrettyTime(it, new Locale("hr")) | |
p.format(delegate) | |
} | |
use(TimeCategory){ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import groovy.swing.SwingBuilder | |
import java.awt.BorderLayout as BL | |
import java.awt.datatransfer.Clipboard | |
import java.awt.datatransfer.StringSelection | |
import java.awt.Toolkit | |
import javax.swing.* | |
class UUIDgenerator { | |
def readIcon() { | |
byte[] iconBytes = new byte[990] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import groovy.json.JsonOutput | |
class User { | |
def ime | |
def prezime | |
} | |
def u = new User(ime:'Ime', prezime:'Prezime') | |
use (JsonOutput) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
serverJvm = AdminControl.queryNames('WebSphere:type=JVM,*') | |
print 'Generating dump for server: ' + serverJvm | |
dumpFile = AdminControl.invoke(serverJvm, 'generateHeapDump') | |
print 'Heap dump file: ' + dumpFile |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int sum | |
(1..999).each { int i -> sum += i%3==0 ? i : i%5==0 ? i:0 } | |
print sum |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int fib(int to, int fibMinOne=0, int fibMinTwo=0) { | |
to > 2 ? ((fibMinTwo==0 ? fib(to - 2):fibMinTwo) + (fibMinOne==0 ? fib (to - 1):fibMinOne)) : to == 2 ? 2: (to== 1 ? 1: 0); | |
} | |
int sum | |
int fibMinOne | |
int fibMinTwo | |
for (int i=0;; i++) { def f = fib(i,fibMinOne,fibMinTwo); fibMinTwo=fibMinOne;fibMinOne=f;if (f>4e6) break; sum+=f%2==0?f:0} | |
print sum |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@GrabConfig(systemClassLoader=true) | |
@Grapes( | |
@Grab(group='javax.mail', module='mail', version='1.4.4') | |
) | |
def ant = new AntBuilder() | |
ant.mail(mailhost:'localhost', mailport:25, subject:'Test message') { | |
from(address:'mySystem@localhost') | |
cc(address:'mySystem@localhost') | |
to(address:'tester@localhost') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//http://msdn.microsoft.com/en-us/library/windows/desktop/aa365247%28v=vs.85%29.aspx#maxpath | |
def dirName = 'd:\\tmp\\' | |
def MAX_PATH = 260 | |
def FILE_NAME = 12 | |
def NULL_SIZE = 1 | |
def i = dirName.length() | |
while (i < MAX_PATH - FILE_NAME - NULL_SIZE) { | |
def iLen = (i as String).length() | |
def currLenValue = i + iLen |
OlderNewer