Skip to content

Instantly share code, notes, and snippets.

View p4535992's full-sized avatar
🙄
I may be slow to respond.

4535992 p4535992

🙄
I may be slow to respond.
View GitHub Profile
// Released under MIT license: http://www.opensource.org/licenses/mit-license.php
$('[placeholder]').focus(function() {
var input = $(this);
if (input.val() == input.attr('placeholder')) {
input.val('');
input.removeClass('placeholder');
}
}).blur(function() {
var input = $(this);
@tecmaverick
tecmaverick / SqlDbType2DbType.cs
Last active March 23, 2022 04:47
Convert .Net Type to SqlDbType or DbType and vise versa
//Convert .Net Type to SqlDbType or DbType and vise versa
//This class can be useful when you make conversion between types .The class supports conversion between .Net Type , SqlDbType and DbType .
using System;
using System.Collections;
using System.Data;
namespace Devintelligence.Common.Data
{
/// <summary>
@aembleton
aembleton / Ignore certificate for HttpURLConnection in Android.java
Created March 27, 2011 17:25
The following code disables SSL certificate checking for any new instances of HttpsUrlConnection
/**
* Disables the SSL certificate checking for new instances of {@link HttpsURLConnection} This has been created to
* aid testing on a local box, not for use on production.
*/
private static void disableSSLCertificateChecking() {
TrustManager[] trustAllCerts = new TrustManager[] { new X509TrustManager() {
public X509Certificate[] getAcceptedIssuers() {
return null;
}
@aknosis
aknosis / gist:997144
Created May 28, 2011 19:32
Execute callback once when a google map is loaded (google maps api)
//Fill in the blanks :)
var map = new google.maps.Map(),
tileListener = google.maps.event.addListener(map,'tilesloaded',fixMyPageOnce);
function fixMyPageOnce(){
//immediately remove the listener (or this thing fires for every tile that gets loaded, which is a lot when you start to pan)
google.maps.event.removeListener(tileListener);
}
@AlBaker
AlBaker / TestDateTime.java
Created June 4, 2011 19:19
Jena and DateTime
package testjena;
import static org.junit.Assert.*;
import org.junit.Test
import org.junit.Before;
import com.hp.hpl.jena.query.ResultSetFormatter;
import com.hp.hpl.jena.query.Query;
@nacx
nacx / BeanLoader.java
Created June 23, 2011 08:58
Spring static Bean loader to load beans outside the Servlet or Sprign context
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;
import org.springframework.stereotype.Service;
@Service
public final class BeanLoader implements ApplicationContextAware
{
private static BeanLoader instance;
private ApplicationContext applicationContext;
@Lobstrosity
Lobstrosity / 1.Widget.cs
Created August 9, 2011 00:13
Mapping Parent-Child Relationships with Dapper
public class Widget
{
public int Id { get; set; }
public string Name { get; set; }
public string Description { get; set; }
}
@aziz781
aziz781 / gist:1336506
Created November 3, 2011 13:43
Spring JMS sample configuration applicationContext-jms.xml
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:jee="http://www.springframework.org/schema/jee"
xmlns:tx="http://www.springframework.org/schema/tx"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:batch="http://www.springframework.org/schema/batch"
xmlns:task="http://www.springframework.org/schema/task"
xmlns:amq="http://activemq.apache.org/schema/core"
@dbuksbaum
dbuksbaum / Loader.cs
Created January 11, 2012 19:48
Loader for loading embedded assemblies
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.InteropServices;
namespace Utility
{
public class Loader
@CristinaSolana
CristinaSolana / gist:1885435
Created February 22, 2012 14:56
Keeping a fork up to date

1. Clone your fork:

git clone git@github.com:YOUR-USERNAME/YOUR-FORKED-REPO.git

2. Add remote from original repository in your forked repository:

cd into/cloned/fork-repo
git remote add upstream git://github.com/ORIGINAL-DEV-USERNAME/REPO-YOU-FORKED-FROM.git
git fetch upstream