Skip to content

Instantly share code, notes, and snippets.

View 0xdevalias's full-sized avatar
👀
Open to opportunities

Glenn 'devalias' Grant 0xdevalias

👀
Open to opportunities
View GitHub Profile
@0xdevalias
0xdevalias / HackMeSomeUnicoins.md
Last active August 29, 2015 13:57
A quick little hack to automagically mine unicoins (stackoverflow.com April Fools 2014) <3 /dev/alias (www.devalias.net)

First, go to stackoverflow.com then define this in your Javascript console:

var hackMeSomeUnicoins = function(myFkey) {
  console.log("Ok, let's hack you some shiny unicoins! <3 /dev/alias (www.devalias.net)")
  console.log("The powers that be say you can only mine a rock every 10sec, so we do it every 11sec to be sure.")
  window.setInterval(function(){
    $.get( "http://stackoverflow.com/unicoin/rock", function( data ) {
      var rockId = data.rock;
      $.post( "http://stackoverflow.com/unicoin/mine?rock=" + rockId, { fkey: myFkey })
 .done(function( data ) {

Using Lombok with Play! 2.2x

http://projectlombok.org/

  • This is mostly a note for me to help save a TON of time screwing around again.
  • Play 2.2.x works 'out of the box' just by including lombok in your dependencies
libraryDependencies ++= Seq(
 foo,
@0xdevalias
0xdevalias / AccessAnnotationMethods.java
Created April 23, 2014 04:55
Example code for accessing methods on a Java annotation using reflection
// TODO: Example code for accessing variables/etc in annotations.
// TODO: Could this be done nicely with a 'map' type functional extraction?
Method m;
try
{
m = Class.forName("MyClass").getMethod("someMethod"); // Class/method that are annotated
MyAnnotation a = m.getAnnotation(MyAnnotation.class); // Annotation class
String someString = a.aStringMethod(); // Thing we want to access
}
catch (SecurityException e)
// http://slurm.trakt.us/js/show/episode.20130474.js
if (document.id('check-in')) {
document.id('check-in').addEvent('click', function () {
if (!window.signedIn) {
Cookie.write('checkinEpisode', '1');
window.signInMessage = 'You need to sign in before you can check into this episode!<br /><a href="#" onclick="resetForms(); document.id(\'header-join\').fireEvent(\'click\'); return false;">Join for free</a> if you don\'t have an account already.';
document.id('header-signin').fireEvent('click');
return false;
}
@0xdevalias
0xdevalias / buildHTML utility
Last active August 29, 2015 14:00 — forked from 1Marc/buildHTML utility
Simple little method to build a html element form the given data object.
/* buildHtml - Helper method to construct html tags easily */
var buildHtml = function(tag, attrs, innerHtml) {
var h = '<' + tag;
for (var attr in attrs) {
if(attrs[attr] === false) {
continue;
}
h += ' ' + attr + '="' + attrs[attr] + '"';
}
return h += innerHtml ? '>' + innerHtml + '</' + tag + '>' : '/>';
@0xdevalias
0xdevalias / JavaScalaFuturePromiseMap.md
Last active November 6, 2015 03:38
A side by side comparison (now that I finally got it figured out!) of Play Framework v2.2.x promise unwrapping in Java and Scala.

Java/Scala Future/Promise Map

A side by side comparison (now that I finally got it figured out!) of Play Framework v2.2.x promise unwrapping in Java and Scala.

Java

  public Promise<ObjectNode> getEmployees(final Optional<String> filterEmail)
	{
		// Call the webservice
@0xdevalias
0xdevalias / play-framework-ws-seperate-library.md
Last active August 29, 2015 14:02
Because I couldn't find it easily on the net, simple notes on how to access Play Framework's seperated WS library
@0xdevalias
0xdevalias / blog-mdwiki-and-how-to-get-started.md
Last active November 21, 2022 10:09
MDwiki (and how to get started)

(Blog post: http://blog.devalias.net/post/92579952637/mdwiki-and-how-to-get-started)

MDwiki (and how to get started)

If you haven't already heard about it, MDwiki is a cool little CMS/Wiki that runs entirely clientside (HTML5/Javascript) and uses Markdown

Since it's all clientside, we can do really cool things like track our changes in git and then host it all on GitHub Pages. That means super simple forking, contributing and sharing. Yay for open source!

Setting up MDwiki with GitHub