Skip to content

Instantly share code, notes, and snippets.

@crazy4groovy
crazy4groovy / database-connections.groovy
Last active October 17, 2016 20:39 — forked from jpertino/databaseConnection.groovy
several database connectors and drivers
// PostgreSQL
@GrabConfig(systemClassLoader=true)
@Grab('postgresql:postgresql:9.4-1211.jdbc4')
def sql = groovy.sql.Sql.newInstance(
"jdbc:postgresql://host.example.org/database",
"username", "password", "org.postgresql.Driver")
// MySQL
@GrabConfig(systemClassLoader=true)
@crazy4groovy
crazy4groovy / bling.js
Created November 25, 2015 00:55 — forked from paulirish/bling.js
bling dot js
/* bling.js */
window.$ = document.querySelectorAll.bind(document);
Node.prototype.on = window.on = function (name, fn) {
this.addEventListener(name, fn);
}
NodeList.prototype.__proto__ = Array.prototype;
@crazy4groovy
crazy4groovy / PrettyPrinter.groovy
Last active September 9, 2015 20:01 — forked from esycat/PrettyPrinter.groovy
A simple way to pretty print nested lists and maps in Groovy.
import static groovy.json.JsonOutput.*
def config = ['test': 'lalala']
println prettyPrint(toJson(config))
@crazy4groovy
crazy4groovy / restApi.groovy
Last active August 29, 2015 14:23 — forked from chiquitinxx/gist:2a89987fe4e611803a7b
Create a Rest API fake in Groovy, using javascript npm modules (faker and json-server)
import org.grooscript.asts.GsNative
class Faker {
private _faker
@GsNative
private faker() {/*
if (!this._faker) {
this._faker = require('faker');
}
@crazy4groovy
crazy4groovy / java7install.sh
Last active August 29, 2015 14:20 — forked from mikakoivisto/java7install.sh
Install java 7 (or 8) silently on Ubuntu
cat - <<-EOF >> /etc/apt/sources.list.d/webupd8team-java.list
# webupd8team repository list
deb http://ppa.launchpad.net/webupd8team/java/ubuntu trusty main
# deb-src http://ppa.launchpad.net/webupd8team/java/ubuntu trusty main
EOF
apt-key adv --recv-keys --keyserver keyserver.ubuntu.com 0xEEA14886
echo debconf shared/accepted-oracle-license-v1-1 select true | /usr/bin/debconf-set-selections
echo debconf shared/accepted-oracle-license-v1-1 seen true | /usr/bin/debconf-set-selections
* {
font-size: 12pt;
font-family: monospace;
font-weight: normal;
font-style: normal;
text-decoration: none;
color: black;
cursor: default;
}
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>sorting lists</title>
<script src="jquery-1.7.2.min.js"></script>
<script src="jquery.sortChildren.js"></script>
<script>
@crazy4groovy
crazy4groovy / fb.js
Last active August 18, 2019 20:11 — forked from ganglio/fb.js
Casperjs example of how to login and scrape an AJAX page.
var casper = require('casper').create({
verbose : true,
logLevel : 'info'
});
var images = [];
var fs=require("fs")
/**
* Configuration here
*/
@crazy4groovy
crazy4groovy / deviantart-example.js
Last active February 3, 2021 21:13 — forked from NuckChorris/deviant.js
Nodejs sample on how to automate the process of login and grab auth headers/tokens/etc.
var http = require('http');
var https = require('https');
/**
* @name deviant.js
* @author Peter Lejeck <peter.lejeck@gmail.com>
* @description deviantJS, handles the process of logging in.
* @version 0.1
*/
import groovy.transform.*
import groovyx.gpars.actor.*
import groovyx.gpars.group.*
@Immutable class Calculate {}
@Immutable class Work { int start, nrOfElements }
@Immutable class Result { double value }
@Immutable class PiApproximation { double pi ; long duration }
double calculatePiFor( int start, int nrOfElements ) {