Skip to content

Instantly share code, notes, and snippets.

View bitsnaps's full-sized avatar
🌍
Working @ CorpoSense

Ibrahim H. bitsnaps

🌍
Working @ CorpoSense
View GitHub Profile
@kimukou
kimukou / pdfboxtest.groovy
Created December 21, 2010 04:09
pdfboxtest.groovy
//see http://www.moriwaki.net/wiki/index.php?[[PDFBox]]
//see pdfbox-1.4.0/pdfbox/src/main/java/org/apache/pdfbox/examples
@Grab(group='org.apache.pdfbox', module='pdfbox', version='1.3.1')
import org.apache.pdfbox.pdfwriter.*
import org.apache.pdfbox.pdmodel.*
import org.apache.pdfbox.pdmodel.font.*
import org.apache.pdfbox.pdmodel.edit.*
String writeFile = "d:/xxx.pdf"
@kimukou
kimukou / JScienceTest.groovy
Created January 21, 2011 16:30
JScienceTest.groovy
// reference http://www.geocities.jp/tomtomf/JScience/JScience.htm
//
@GrabResolver (name='jcurl-repository', root='http://jcurl.berlios.de/m2/repo/')
@Grab(group = 'org.jscience', module='jscience', version='4.3.1')
import org.jscience.mathematics.number.Complex
import org.jscience.mathematics.vector.ComplexMatrix
//計算結果の出力様関数
def show(cm) {
@fajrif
fajrif / rvm_cheatsheet
Created June 14, 2011 14:11
RVM cheatsheet
RVM home page: http://rvm.beginrescueend.com
Install RVM
------------
See http://rvm.beginrescueend.com/rvm/install/
bash < <(curl -s https://raw.github.com/wayneeseguin/rvm/master/binscripts/rvm-installer)
Install rvm for all users
@mariuz
mariuz / DriverExample.java
Created June 23, 2011 19:54
Firebird driver example using jaybird-full jar
// Original version of this file was part of InterClient 2.01 examples
//
// Copyright InterBase Software Corporation, 1998.
// Written by com.inprise.interbase.interclient.r&d.PaulOstler :-)
//
// Code was modified by Roman Rokytskyy to show that Firebird JCA-JDBC driver
// does not introduce additional complexity in normal driver usage scenario.
//
// A small application to demonstrate basic, but not necessarily simple, JDBC features.
//
@akihiro4chawon
akihiro4chawon / Main.groovy
Created July 4, 2011 08:44
Memoization with Groovy Custom AST Tranformation
package akihiro4chawon
class Main {
@Memoize
def fib(a) {
//a <= 1 ? a : fib(a - 2) + fib(a - 1)
if (a <= 1) return a
else return fib(a - 2) + fib(a - 1)
}
@antsmartian
antsmartian / version2.groovy
Created April 8, 2012 17:09
Web Scraping using Groovy and Jsoup!
import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.jsoup.nodes.Element;
import org.jsoup.select.Elements;
println "WebScraping with Groovy \n"
def url = "http://rates.goldenchennai.com/";
def url2 = "http://scores.sify.com/index.shtml"
def document = Jsoup.connect(url).get();
def cricDocument = Jsoup.connect(url2).get()
def goldDetails = document.select(".yellowTxt")
@deanriverson
deanriverson / build.gradle
Last active May 12, 2018 12:55
Basic Gradle build file for a project using GroovyFX 0.2
apply plugin:'groovy'
project.ext.set('javafxHome', System.env['JAVAFX_HOME']
repositories { mavenCentral() }
dependencies {
groovy 'org.codehaus.groovy:groovy-all:1.8.6'
compile 'org.codehaus.groovyfx:groovyfx:0.4.0'
compile files("${javafxHome}/rt/lib/jfxrt.jar")
@crazy4groovy
crazy4groovy / MockFor.groovy
Created June 23, 2012 17:16
Groovy MockFor example
//http://groovy.codehaus.org/Using+MockFor+and+StubFor
import groovy.mock.interceptor.*
/*sample data class*/
class Movie {
// Lots of expensive method calls, etc.
}
/*helper class*/
@kylebgorman
kylebgorman / em2gaus.py
Created June 26, 2012 00:02
EM for a mixture of 2 univariate Gaussians
#!/usr/bin/env python
#
# Copyright (c) 2012 Kyle Gorman
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
@bellbind
bellbind / tetris-svg.html
Created November 20, 2012 09:22
[javascript][svg]tetris model with svg ui (arrow key control)
<!doctype html>
<html>
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge;chrome=1" />
<script src="tetris.js"></script>
<script src="tetris-svg.js"></script>
</head>
<body>
<div><svg id="stage"></svg></div>