Skip to content

Instantly share code, notes, and snippets.

@DinisCruz-Dev
DinisCruz-Dev / 1.a. execute groovy from Groovy Script.java
Last active December 28, 2015 10:09
SWTBot scritps (inside TeamMentor Eclipse Plugin)
//run these first (so that the code below compiles)
eclipseAPI.extraGroovyJars =
[ "/Users/plugin/_Dev/eclipses/Kepler/plugins/org.eclipse.swtbot.eclipse.finder_2.1.2.201311041021.jar" ,
"/Users/plugin/_Dev/eclipses/Kepler/plugins/org.eclipse.swtbot.swt.finder_2.1.2.201311041021.jar" ,
"/Users/plugin/_Dev/eclipses/Kepler/plugins/org.apache.log4j_1.2.15.v201012070815.jar" ]
def groovyExecution = view.groovyExecution;
def groovyShell = groovyExecution.groovyShell;
//def jar = "asd";
import org.eclipse.swt.SWT;
import org.eclipse.swt.browser.Browser;
import org.eclipse.swt.widgets.*;
import org.eclipse.swt.graphics.Rectangle;
import org.eclipse.jface.action.Action;
import org.eclipse.ui.internal.about.*;
def panel = eclipseAPI.panels.add_Panel("asd_2 123");
for (def control : panel.composite.getChildren()) {
@DinisCruz-Dev
DinisCruz-Dev / 1.original sample code.html
Last active August 29, 2015 13:56
vulnerable websocket code from websocket.org (http://www.websocket.org/echo.html)
<!DOCTYPE html>
<meta charset="utf-8" >
<title>WebSocket Test></title>
<script language="javascript" type="text/javascript">
var wsUri = "ws://echo.websocket.org/";
var output;
@DinisCruz-Dev
DinisCruz-Dev / eclipse_karma_views.groovy
Last active August 29, 2015 13:56
Create a Eclipse views to show AngularJS tests executed with Karma
eclipse.views.create("Karma Runner")
.clear()
.add.browser()
.open("http://localhost:9879/__karma/")
eclipse.views.create("Website")
.clear()
.add.browser()
.open("http://localhost:9879/index.html")
@DinisCruz-Dev
DinisCruz-Dev / 1. Get request with current data.groovy
Last active October 10, 2015 21:31
Misc Groovy Scripts that invoke the Firebase APIs
def firebaseJsonData = "https://incandescent-fire-1320.firebaseio.com/.json?print=pretty"
def data = firebaseJsonData.toURL().getText()
return data;
@DinisCruz-Dev
DinisCruz-Dev / 1. Eclipse - Groovy script to refresh browser on save.groovy
Last active July 12, 2016 13:07
Eclipse script to sync browser with editor
def editorTitle = "Firebase_Login.html"
import java.nio.file.*;
import com.sun.nio.file.*
def refreshBrowser = { path ->
eclipse.log("Opening browser with: " + path);
eclipse.views.create(path).clear().add.browser().open(path);
};
@DinisCruz-Dev
DinisCruz-Dev / 1a. simple Angular with route - Firebase_Login.html
Last active May 17, 2020 22:47
Creating an AngularJS page with Firebase login
<!doctype html>
<html ng-app="project">
<head>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.13/angular.js" ></script>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.13/angular-route.js"></script>
<link href="http://netdna.bootstrapcdn.com/bootstrap/3.0.3/css/bootstrap.min.css" rel="stylesheet" >
<script src="app.js"></script>
</head>
<body>
@DinisCruz-Dev
DinisCruz-Dev / 1. send 1000 pushes to firebase in c#.cs
Last active August 29, 2015 13:56
Script to test Firebase and C# performace
var msgSent = 1;
var errors = 0;
Action<string,string,string,string> sendMessage =
(app,token, area, message)=>
{
ThreadPool.QueueUserWorkItem((o)=>
{
var url = "https://{0}.firebaseio.com/{1}.json?auth={2}".format(app, area, token);
var now = DateTime.Now. TimeOfDay; //DateTime.Now.ToShortTimeString();
var data = "\"[{0}] {1}\"".format(now, message.replace("\"", "'"));
@DinisCruz-Dev
DinisCruz-Dev / 1. hook TeamMentor BeginRequest and send url to firebase.c#
Created February 27, 2014 15:23
C# REPL scripts to Communitcate with Firebase
Action<string,string,string,string> sendData_Raw =
(app,token, area, data)=>
{
ThreadPool.QueueUserWorkItem((o)=>
{
var url = "https://{0}.firebaseio.com/{1}.json?auth={2}".format(app, area, token);
var now = DateTime.Now.ToShortTimeString(); // DateTime.Now. TimeOfDay;
var postData = "\"{0}: {1}\"".format(now, data.replace("\"", "'"));
url.POST(postData);
});
@DinisCruz-Dev
DinisCruz-Dev / _views_messages.html
Last active August 29, 2015 13:56
Nice Simple AngularJS + Firebase + C# REST PoC.
<h5>Current messages:</h5>
<table class="table table-striped">
<thead>
<tr>
<th>message</th>
</tr>
</thead>
<tbody>
<tr ng-repeat="message in messages" >