Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View skyebook's full-sized avatar

Skye Book skyebook

View GitHub Profile
@skyebook
skyebook / push-defense.sh
Last active August 29, 2015 14:10
push-defense
#!/bin/bash
gitResult=$(git --version | grep 'git version 2.')
if [ -n "$gitResult" ]; then
# Don't push to any remotes unless a remote branch is specified
git config --global push.default nothing
mkdir -p ~/bin/git-hooks/hooks
@skyebook
skyebook / UnfuckedButton.m
Created February 1, 2015 01:03
Put titleLabel under UIButtton imageView
- (CGRect)titleRectForContentRect:(CGRect)contentRect
{
// Can't reference titleLabel directly in here, so get the frame by calling into the UIButton implementation
CGRect defaultTitleFrame = [super titleRectForContentRect:contentRect];
CGSize titleSize = defaultTitleFrame.size;
CGPoint imageCenter = self.imageView.center;
return CGRectMake(imageCenter.x - (titleSize.width/2), imageCenter.y+titleSize.height, titleSize.width, titleSize.height);
}
@skyebook
skyebook / ExportWindow.mel
Last active August 29, 2015 14:19
Betaville Batch Exporter for Maya
-title "RE-Export building .DAE"
-widthHeight 100 100;
rowLayout -numberOfColumns 2;
columnLayout -adjustableColumn true;
button -label "A-------MoveTool-----------------"
-command
MoveTool;
EnterEditMode;
ctxEditMode;
button -label "B-------CenterPivot-------------"
@skyebook
skyebook / ListUtils.java
Created August 11, 2015 21:02
Clamped subList
package donald.trump.for.president;
import java.util.List;
public class ListUtils {
/**
* Return a list containing, at most, the number of requested objects. If
* there are less than <code>count</code> items present, all items in the
* list are returned.
@skyebook
skyebook / gist:2038029
Created March 14, 2012 17:21
PostGIS GDAL Setup
/usr/bin/ld: cannot find -ldgal
/dev/zero: file not recognized: File format not recognized
collect2: ld returned 1 exit status
@skyebook
skyebook / gist:2039034
Created March 14, 2012 19:53
PostGIS r9499 Regression Test
develop@develop-VirtualBox:~/src/postgis$ make check
/usr/bin/perl utils/svn_repo_revision.pl
Not updating existing rev file at 9499
for s in liblwgeom libpgcommon postgis regress raster topology loader utils extensions; do \
echo "---- Making all in ${s}"; \
make -C ${s} all || exit 1; \
done;
---- Making all in liblwgeom
make[1]: Entering directory `/home/develop/src/postgis/liblwgeom'
WARNING: Lexer not generated. Run 'make parse' to manually build lexer/parser.
@skyebook
skyebook / gist:3152659
Created July 20, 2012 19:13
Mercator Meters Per Pixel
public static final double EARTH_CIRCUMFERENCE = 637279.82;
public double getMetersPerPixelAt(LatLon latLon, int zoomLevel){
//S=C*cos(y)/2^(z+8)
double latCos = Math.cos(Math.toDegrees(latLon.getLat()));
System.out.println("latCos " + latCos);
double result = EARTH_CIRCUMFERENCE*latCos;
return result/Math.pow(2, zoomLevel+8);
}
@skyebook
skyebook / gist:3231657
Created August 1, 2012 23:52
Post Body to Javascript Fail
function doRequest(request, headers, http_method, request_body, successCallback, failureCallback){
$.ajax({
url: api+request,
headers: headers,
data:JSON.stringify(request_body),
//data:request_body,
processData:false,
type: http_method,
contentType: "application/json",
error: function(XMLHttpRequest, textStatus, errorThrown){
@skyebook
skyebook / gist:3288293
Created August 7, 2012 18:50
wp_options cleanser
<?php
/**
* Remove expired transients from the wp_options table.
* This script cycles through a number of expired transients until it doesn't find anymore.
* Our wp_options tables has over 2 million stale entries at time of writing, this limiting is really needed
* @author Skye Book
*/
$user = "";
$pass = "";
skyebookpro:Party skyebook$ rhc app restart -a MPCParty
Password: ************
Problem reported from server. Response code was 500.
Re-run with -d for more information.
RESULT:
Node execution failure (invalid exit code from node). If the problem persists please contact Red Hat support.
skyebookpro:Party skyebook$ rhc app force-stop -a MPCParty