Skip to content

Instantly share code, notes, and snippets.

View palmerc's full-sized avatar

Cameron Lowell Palmer palmerc

View GitHub Profile
@palmerc
palmerc / Ruter_API
Created March 7, 2013 13:17
A proposed replacement for the Ruter API. Maybe a servlet could frontend the Ruter server to translate to a cleaner API
## Ruter API Proposal ##
## Stops ##
stops - Return a list of all stops
stops/ID - Return information about a specific stop
stops/name - Return information about a specific stop
stops?filter=autocomplete/name - Return possible matching names and IDs
stops/ID/departures - Return realtime departures for a stop
stops/ID/arrivals - Return realtime arrivals for a stop
stops/ID/departures?filter=schedule - Return the scheduled times for the stop
public class InteractiveMapView extends View {
private static final String TAG = "InteractiveMapView";
private Picture mMapPicture;
private static final float PAN_VELOCITY_FACTOR = 2f;
private static final float ZOOM_AMOUNT = 0.25f;
private RectF mCurrentViewport;
private Rect mContentRect = new Rect();
Euro-Center USA
140 West 57th St.
Suite 6 A
New York City, N.Y. 10019-3326
Åpent hverdager 09.30-17.30
Tlf: +1 212 265 8522
Gratis linje (i USA): 1 800 844 3876
private ChartItem getChartItem(int costType, int monthNumber, Map<Integer, Map<Integer, Integer>> mapAmounts){
Map<Integer, Integer> mapValue = mapAmounts.get(monthNumber);
if(mapValue == null)
return null;
int year1 = 0, year2 = 0, value1 = 0, value2 = 0;
Iterator<Integer> itr = mapValue.keySet().iterator();
while(itr.hasNext()){
@palmerc
palmerc / gist:8749976
Last active August 29, 2015 13:55
Is this the best way to get cell height with auto-layout?
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
WBSEpisode *episode = [self.episodes objectAtIndex:indexPath.row];
WBSFantorangenEpisodeTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:kFantorangenEpisodesTableViewCellReuseIdentifier];
cell.episode = episode;
[cell setNeedsLayout];
@palmerc
palmerc / proxy.pac
Last active December 2, 2019 11:36
A proxy.pac
function FindProxyForURL(url, host) {
return "SOCKS 192.168.2.231:8889";
}
@palmerc
palmerc / mac-clang-omp-setup.sh
Last active August 29, 2015 14:05
Download, compile LLVM and OpenMP Runtime for Mac
INTEL_OPENMP_LATEST_BUILD_LINK=https://www.openmprtl.org/sites/default/files/libomp_20131209_oss.tgz
CLANG_INCLUDE=~/code/llvm/include
CLANG_BIN=~/code/llvm/build/Debug+Asserts/bin
CLANG_LIB=~/code/llvm/build/Debug+Asserts/lib
OPENMP_INCLUDE=~/code/libomp_oss/exports/common/include
OPENMP_LIB=~/code/libomp_oss/exports/mac_32e/lib.thin
cd ~/
mkdir code
cd ~/code
@palmerc
palmerc / libomp-setup.sh
Created August 26, 2014 09:44
Setup libomp for the Mac dependent on the llvm-omp environment
ROOT_DIR=${PWD}
BUILD_DIR=${ROOT_DIR}/omp-src
LLVM_SRC_DIR=${BUILD_DIR}/llvm
LLVM_BUILD_DIR=${BUILD_DIR}/llvm-build
LIBOMP_SRC_DIR=${BUILD_DIR}/libomp_oss
INTEL_OPENMP_LATEST_BUILD_LINK=https://www.openmprtl.org/sites/default/files/libomp_20131209_oss.tgz
OPENMP_INCLUDE=${LIBOMP_SRC_DIR}/exports/common/include
OPENMP_LIB=${LIBOMP_SRC_DIR}/exports/mac_32e/lib.thin
@palmerc
palmerc / llvm-omp-setup.sh
Created August 26, 2014 09:45
Setup the LLVM compiler with the OpenMP extensions
ROOT_DIR=${PWD}
BUILD_DIR=${ROOT_DIR}/omp-src
INSTALL_DIR=/usr/local/llvm-omp
LLVM_SRC_DIR=${BUILD_DIR}/llvm
LLVM_BUILD_DIR=${BUILD_DIR}/llvm-build
CLANG_INCLUDE=${LLVM_SRC_DIR}/include
CLANG_BIN=${LLVM_BUILD_DIR}/Release+Asserts/bin
CLANG_LIB=${LLVM_BUILD_DIR}/Release+Asserts/lib
@palmerc
palmerc / llvm-omp-environment.sh
Created August 26, 2014 09:46
Setup up some critical values for LLVM OpenMP to function
#!/bin/bash
OPENMP_DIR=/usr/local/llvm-omp
export CC=${OPENMP_DIR}/bin/clang
export CXX=${OPENMP_DIR}/bin/clang++
export CMAKE_C_COMPILER=${CC}
export CMAKE_CXX_COMPILER=${CXX}
export PATH=${OPENMP_DIR}/bin:${PATH}
export C_INCLUDE_PATH=${OPENMP_DIR}/include:${C_INCLUDE_PATH}
export CPLUS_INCLUDE_PATH=${OPENMP_DIR}/include:${CPLUS_INCLUDE_PATH}