Skip to content

Instantly share code, notes, and snippets.

/*
* Modifications by Yoni Samlan; based on RealViewSwitcher, whose license is:
*
* Copyright (C) 2010 Marc Reichelt
*
* Work derived from Workspace.java of the Launcher application
* see http://android.git.kernel.org/?p=platform/packages/apps/Launcher.git
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@drei01
drei01 / ecommercehackday-2012-puzzle
Created June 29, 2012 16:31
ecommercehackday puzzle 2012
function bin (text) {
var output = ''
for (var i = 0 ; i < text.length; i+= 8) {
var c = 0;
for (var j=0; j < 8 ; j++) {
c <<= 1;
c |= parseInt(text[i + j]);
}
output += String.fromCharCode(c);
}
@drei01
drei01 / roll-links.css
Last active December 11, 2015 21:38
css3 roll links
@drei01
drei01 / java_scratchpad
Last active December 11, 2015 23:08
A Java syntax scratchpad based on: https://gist.github.com/4666256 Paste the following into your browser and hit enter
data:text/html, %3Clink%20rel%3D%22shortcut%20icon%22%20href%3D%22http%3A%2F%2Fg.etfv.co%2Fhttp%3A%2F%2Fwww.sublimetext.com%22%2F%3E%20%3Cstyle%20type%3D%22text%2Fcss%22%3E%23e%7Bposition%3Aabsolute%3Btop%3A0%3Bright%3A0%3Bbottom%3A0%3Bleft%3A0%3B%7D%3C%2Fstyle%3E%3Cdiv%20id%3D%22e%22%3E%3C%2Fdiv%3E%3Cscript%20src%3D%22http%3A%2F%2Fd1n0x3qji82z53.cloudfront.net%2Fsrc-min-noconflict%2Face.js%22%20type%3D%22text%2Fjavascript%22%20charset%3D%22utf-8%22%3E%3C%2Fscript%3E%3Cscript%3Evar%20e%3Dace.edit(%22e%22)%3Be.setTheme(%22ace%2Ftheme%2Feclipse%22)%3Be.getSession().setMode(%22ace%2Fmode%2Fjava%22)%3B%3C%2Fscript%3E
@drei01
drei01 / Unicorn.java
Last active December 13, 2015 22:29
Answer to the "Pat the Unicorns" puzzle. http://zeroturnaround.com/fun/magical-java-puzzle-pat-the-unicorns/ # example run javac MagicalLand.java java MagicalLand UNICORN #1: PAT THIS UNICORN ONCE UNICORN #2: PAT THIS UNICORN ONCE END OF PROGRAM
public class MagicalLand {
public static void main(String[] args) {
for (int i = 0; i < (Math.random() * 500) + 2; i++) {
if (Unicorn.pat()) {
System.out.println("UNICORN #1: PAT THIS UNICORN ONCE");
}
}
for (int i = 0; i < (Math.random() * 500) + 2; i++) {
if (Unicorn.pat()) {
$('.filter-name').keyup(function () {
if (this.value) {
$('#available-mps .mp').hide();
$('#available-mps .mp[data-name^="' + (this.value.replace(/(?:^|\s)\w/g, function(match) {return match.toUpperCase();})) + '"]').show();
} else {
$('#available-mps .mp').show();
}
});
var request = require('request'),
randomstring = require("randomstring"),
colors = require('colors'),
templates = require('./email-list.js').templates,
args = process.argv.slice(2);
if (args.length < 3 || args.length > 3) {
console.log('Usage node rapportive.js firstname lastname domain.com');
return;
}
alert('xss')
<com.google.android.gms.maps.mapview xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:id="@+id/mapView">
</com.google.android.gms.maps.mapview>
@drei01
drei01 / JSONUserType.java
Created March 19, 2015 14:25
Hibernate Postgres Json User Type
import java.io.IOException;
import java.io.Serializable;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Types;
import java.util.Properties;
import org.hibernate.HibernateException;
import org.hibernate.engine.spi.SessionImplementor;