Skip to content

Instantly share code, notes, and snippets.

View ammachado's full-sized avatar

Adriano Machado ammachado

View GitHub Profile
#!/usr/bin/env bash
# git-addremove
git add -A
git ls-files --deleted | xargs git rm
// jquery.jqax.js - A plugin for jQuery ajax wrapping some common
// functionality aimed at .NET services and page methods
// Ben Cull - 18 August 2010
(function($) {
$.jQax = function(options) {
// Load Defaults and make them public
this.defaults = {
ShowLoading: true,
@mping
mping / page.html
Created October 14, 2010 14:37
xhtmlrenderer (Flying Saucer) with css3 header/footer
<link href="print.css" rel="stylesheet" type="text/css" media="screen,print"/>
...
<div style="-fs-page-sequence: start; page-break-before: always">
<div style="position: running(current);">
<div id="page-header" class="small">
<span class="align-left">some stuff here</span>
<span class="align-right">some other stuff here</span>
<div class="line">&#160;</div>
@jonnywray
jonnywray / FutureUpdateBehavior.java
Last active September 3, 2021 15:16
Wicket FutureUpdateBehavior: allows asynchronous update of components.
import org.apache.wicket.ajax.AbstractAjaxTimerBehavior;
import org.apache.wicket.ajax.AjaxRequestTarget;
import org.apache.wicket.util.time.Duration;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.Future;
@kiy0taka
kiy0taka / h2console.groovy
Created November 27, 2010 14:33
H2 Web Console
@Grab('org.mortbay.jetty:jetty-embedded:6.1.25')
@Grab('com.h2database:h2:1.2.144')
@Grab('mysql:mysql-connector-java:5.1.13')
import org.mortbay.jetty.Server
import org.mortbay.jetty.servlet.Context
import org.h2.server.web.WebServlet
def server = new Server(8080)
new Context(server, "/", Context.SESSIONS).addServlet(WebServlet, "/*")
server.start()
@kamranayub
kamranayub / gist:935461
Created April 21, 2011 21:00
This ProxyConverter can be used with AutoMapper to help when converting Entity Framework proxied objects (i.e. DynamicProxy_xxxxxxx). Room for improvement. See: http://stackoverflow.com/questions/3441916/automapper-mapping-issue-with-inheritance-and-abstr
// See: http://stackoverflow.com/questions/3441916/automapper-mapping-issue-with-inheritance-and-abstract-base-class-on-collection/5749579#5749579
//
// For use with AutoMapper
public class ProxyConverter<TSource, TDestination> : ITypeConverter<TSource, TDestination>
where TSource : class
where TDestination : class
{
public TDestination Convert(ResolutionContext context)
{
// Get dynamic proxy base type
@esperlu
esperlu / mysql2sqlite.sh
Created April 27, 2011 05:46
MySQL to Sqlite converter
#!/bin/sh
# Converts a mysqldump file into a Sqlite 3 compatible file. It also extracts the MySQL `KEY xxxxx` from the
# CREATE block and create them in separate commands _after_ all the INSERTs.
# Awk is choosen because it's fast and portable. You can use gawk, original awk or even the lightning fast mawk.
# The mysqldump file is traversed only once.
# Usage: $ ./mysql2sqlite mysqldump-opts db-name | sqlite3 database.sqlite
# Example: $ ./mysql2sqlite --no-data -u root -pMySecretPassWord myDbase | sqlite3 database.sqlite
@140bytes
140bytes / LICENSE.txt
Created May 9, 2011 16:13
140byt.es -- Click ↑↑ fork ↑↑ to play!
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2011 YOUR_NAME_HERE <YOUR_URL_HERE>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
@jonnywray
jonnywray / AjaxBlockUIDecorator.java
Created May 11, 2011 23:51
Wicket decorator that uses jQuery to block the UI while an Ajax request completes
import org.apache.wicket.Component;
import org.apache.wicket.ajax.calldecorator.AjaxCallDecorator;
/**
* Ajax call decorator to block the page while the Ajax callback
* occurs.
*
* For some reason the jQuery plugin used for this decorator continues
* with a spinning wheel after the response is done until focus leaves
* the form component. Same thing happens on their web site. Find a better
@jonnywray
jonnywray / AjaxDynamicTabbedPanel.java
Created May 11, 2011 23:55
Wicket component for a tabbed panel that gets tab definitions from a model thus allowing tabs to be defined dynamically
import org.apache.wicket.ajax.AjaxRequestTarget;
import org.apache.wicket.ajax.markup.html.AjaxFallbackLink;
import org.apache.wicket.extensions.markup.html.tabs.ITab;
import org.apache.wicket.markup.html.WebMarkupContainer;
import org.apache.wicket.model.IModel;
import java.util.List;
/**
* Ajax based extension of the dynamic tabbed panel