Skip to content

Instantly share code, notes, and snippets.

@rosskarchner
rosskarchner / export.py
Created February 21, 2011 22:48
extract tiles from an mbtiles file
import sqlite3, os
conn = sqlite3.connect('Mills1860.mbtiles')
results=conn.execute('select * from tiles').fetchall()
for result in results:
zoom, column, row, png= result
try:
os.makedirs('%s/%s/' % (zoom, row))
@ebeeson
ebeeson / jetty-single-webapp.xml
Created August 7, 2011 09:19
The simplest jetty config file for a single webapp.
<?xml version="1.0"?>
<!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN" "http://www.eclipse.org/jetty/configure.dtd">
<Configure class="org.eclipse.jetty.server.Server">
<Set name="connectors">
<Array type="org.eclipse.jetty.server.Connector">
<Item>
<New class="org.eclipse.jetty.server.nio.SelectChannelConnector">
<Set name="Port"><SystemProperty name="jetty.port" default="8080"/></Set>
</New>
@dangt85
dangt85 / Home.java
Created September 25, 2011 00:15
A sample of basic Spring controller for salesforce.com oauth.
package com.appspot.dangt85.controllers;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
@jcarlosgarcia
jcarlosgarcia / gist:1621770
Created January 16, 2012 16:55
Set system properties via Spring XML configuration
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:util="http://www.springframework.org/schema/util"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-3.0.xsd">
<bean id="systemProps" class="org.springframework.beans.factory.config.MethodInvokingFactoryBean">
<property name="targetObject" value="#{@systemProperties}" />
<property name="targetMethod" value="putAll" />
@sbob909
sbob909 / gist:1886593
Created February 22, 2012 18:44
Sample Data for Apex Workbook Spring 2012
Merchandise__c[] ml = new List<Merchandise__c>();
Merchandise__c m = new Merchandise__c(
Name='Pencils',
Description__c='Cool pencils',
Price__c=1.5,
Total_Inventory__c=1000);
ml.add(m);
Merchandise__c m2 = new Merchandise__c(
Name='Notebooks',
Description__c='Blue notebooks',
anonymous
anonymous / Mapper.ph
Created August 1, 2012 00:19
Mapper.py
#!/usr/bin/env python
import sys
# input comes from STDIN (standard input)
for line in sys.stdin:
# remove leading and trailing whitespace
line = line.strip()
# split the line into words
words = line.split('|')
<!--
Author - Mohit Shrivastav
Co-Author - Harshit Pandey (Revised Code)
// ======== Angular JS with Visualforce ====
This page list down the fields of Account and list the fields by Querying Salesforce
User can search sort and paginate the data presentation pretty quickly and fancy way
using Angular.JS
-->
apply plugin: 'java'
apply plugin : 'war'
group = 'com.cadrlife'
version = '1.0.0'
buildscript {
repositories {
mavenCentral()
}
@nicerobot
nicerobot / install.sh
Last active January 16, 2024 07:34
Whew! QGIS 2 on Mavericks built using only Homebrew packages (i.e. without KyngChaos) \o/ -- WARNING: A _major_ assumption here is that your Homebrew PREFIX is /usr/local . -- DISCLAIMER: It worked for me. YMMV
#!/bin/bash
# Run this:
#
# curl https://gist.github.com/nicerobot/7664605/raw/install.sh | bash -s do-sudo
#
# which will run:
[ -f qgis2-homebrew-build.sh ] || {
curl -O https://gist.github.com/nicerobot/7664605/raw/qgis2-homebrew-build.sh
@pchittum
pchittum / ViewStateStudy_controller
Created December 12, 2013 15:39
How Visualforce passes data between two pages. These are examples supporting a post on salesforce.stackexchange.com regarding how to "save" data when redirecting to another page. My argument was that one solution is to take advantage of view state in Visualforce to pass the data around. http://salesforce.stackexchange.com/questions/21899/starts-…
public with sharing class ViewStateStudy_controller {
public String accId{get;set;}
public Account account{get;set;}
public ViewStateStudy_controller()
{
accId = ApexPages.currentPage().getParameters().get('Id');
if(accId != null)
{