Skip to content

Instantly share code, notes, and snippets.

Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
/**
* Created by Adil on 15/01/2016.
*/
@Singleton
public class UserDao implements IDao<User,Long> {
@Override
public Optional<User> get(Long id) {
Connection connection = DB.getConnection();
String userSQL = "SELECT * FROM users WHERE users.id = ?";
@adilold
adilold / designer.html
Created January 6, 2015 17:27
designer
<link rel="import" href="../polymer/polymer.html">
<polymer-element name="my-element">
<template>
<style>
:host {
position: absolute;
width: 100%;
height: 100%;
@adilold
adilold / designer.html
Created January 6, 2015 17:23
designer
<link rel="import" href="../core-icon-button/core-icon-button.html">
<link rel="import" href="../core-toolbar/core-toolbar.html">
<link rel="import" href="../core-header-panel/core-header-panel.html">
<link rel="import" href="../core-icons/core-icons.html">
<link rel="import" href="../paper-item/paper-item.html">
<polymer-element name="my-element">
<template>
<style>
@adilold
adilold / gist:11385724
Created April 28, 2014 22:21
keybase.md
### Keybase proof
I hereby claim:
* I am adilhz on github.
* I am adil_h (https://keybase.io/adil_h) on keybase.
* I have a public key whose fingerprint is 8548 500E 98C3 03CD A35F B9E5 3388 99E6 6CD2 92AD
To claim this, I am signing this object:
@adilold
adilold / download_papers.py
Created January 6, 2014 12:53
Download Edexcel C1 maths papers to a directory.
import urllib2
import urllib
from bs4 import BeautifulSoup
def download():
web_page = urllib2.urlopen("http://www.mathspapers.co.uk/edexcel.html").read()
soup = BeautifulSoup(web_page)
for link in soup.find_all('a'):
download_uri = link.get('href')
if "6663" in download_uri:
@adilold
adilold / map.js
Created June 21, 2013 23:22
Map.js, a simple, easy to use implementation of a map-like structure in JavaScript
/**
* Map.js - Created by Adil
* A simple class to abstract away Object literals
*/
Function.prototype.method = function (name, func) {
this.prototype[name] = func;
return this;
@adilold
adilold / RemoteService.java
Created November 16, 2012 23:53
Simple NIO2 java implementation
package adil.server;
import java.io.IOException;
import java.net.InetAddress;
import java.net.InetSocketAddress;
import java.net.SocketAddress;
import java.nio.ByteBuffer;
import java.nio.channels.AsynchronousServerSocketChannel;
import java.nio.channels.AsynchronousSocketChannel;
@adilold
adilold / GenericDao.java
Created November 14, 2012 21:56
Generic DAO using Java generics! :D
/**
* Establishes the DAO pattern for use with other classes.
* @author Adil
*
*/
public class GenericDao<T> {
@SuppressWarnings("unchecked")