Skip to content

Instantly share code, notes, and snippets.

View kvermeille's full-sized avatar
:shipit:
Kicking Butt

Ken Vermeille kvermeille

:shipit:
Kicking Butt
View GitHub Profile
@Abizern
Abizern / git versioner
Created October 12, 2009 23:05
Xcode build script that adds the commit sha to the CFBundleVersion
#!/usr/bin/env ruby
# Xcode auto-versioning script for Subversion by Axel Andersson
# Updated for git by Marcus S. Zarra and Matt Long
# Converted to ruby by Abizer Nasir
# Appends the git sha to the version number set in Xcode.
# see http://www.stompy.org/2008/08/14/xcode-and-git-another-build-script/ for more details
# These are the common places where git is installed.
# Change this if your path isn't here
@hramos
hramos / manifest.plist
Created January 11, 2011 14:29
Sample manifest file for Over The Air iOS deployment
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>items</key>
<array>
<dict>
<key>assets</key>
<array>
<dict>
@karmadude
karmadude / node-mysql2json.js
Created December 8, 2011 03:34
Using Node to export MySQL query results to a file as JSON
// https://github.com/felixge/node-mysql
// npm install mysql
var mysql = require('mysql');
// http://nodejs.org/docs/v0.6.5/api/fs.html#fs.writeFile
var fs = require('fs');
var client = mysql.createClient({
user: 'root',
password: 'mysqlpassword'
@vasrap
vasrap / mercator-latlon-to-meters.rb
Last active March 15, 2021 15:54
Lat/Lon to Meters using Mercator projection
puts "Enter latitude in decimal degrees:"
lat_deg = gets.to_f
puts "Enter longitude in decimal degrees:"
lon_deg = gets.to_f
lon_rad = (lon_deg / 180.0 * Math::PI)
lat_rad = (lat_deg / 180.0 * Math::PI)
sm_a = 6378137.0
x = sm_a * lon_rad
y = sm_a * Math.log((Math.sin(lat_rad) + 1) / Math.cos(lat_rad))
@swankjesse
swankjesse / RetrofitCachingExample.java
Created June 29, 2013 03:03
Demonstrate HTTP caching with OkHttp and Retrofit.
/*
* Copyright (C) 2013 Square, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
@orip
orip / PicassoUtils.java
Last active July 18, 2018 08:39
Working around https://github.com/square/okhttp/issues/184 for Picasso 2.x (older revisions for Picasso 1.1.1)
package com.example;
import android.content.Context;
import com.squareup.okhttp.HttpResponseCache;
import com.squareup.okhttp.OkHttpClient;
import com.squareup.picasso.OkHttpDownloader;
import com.squareup.picasso.Picasso;
import javax.net.ssl.SSLContext;
import java.io.File;
@bradmontgomery
bradmontgomery / install-comodo-ssl-cert-for-nginx.rst
Last active June 10, 2024 15:37
Steps to install a Comodo PositiveSSL certificate with Nginx.

Setting up a SSL Cert from Comodo

I use Namecheap.com as a registrar, and they resale SSL Certs from a number of other companies, including Comodo.

These are the steps I went through to set up an SSL cert.

Purchase the cert

@psi-4ward
psi-4ward / GridStream.js
Created October 22, 2013 11:28
NodeJS MongoDB-GridFS Video range stream example Lets your browser seek/jump wihin the video-playback.
var app = require('express')();
var GridStore = require('mongodb').GridStore;
var ObjectID = require('mongodb').ObjectID;
var MongoClient = require('mongodb').MongoClient;
var Server = require('mongodb').Server;
var dbConnection;
MongoClient.connect("mongodb://localhost:27017/ersatz?auto_reconnect", {journal: true}, function(err, db) {
dbConnection = db;
app.listen(3000);
@brennanMKE
brennanMKE / textHeight.m
Created March 5, 2014 17:48
Text Height in Objective-C for NSString and NSAttributedString
- (CGFloat)heightForAttributedString:(NSAttributedString *)text maxWidth:(CGFloat)maxWidth {
if ([text isKindOfClass:[NSString class]] && !text.length) {
// no text means no height
return 0;
}
NSStringDrawingOptions options = NSStringDrawingUsesLineFragmentOrigin | NSStringDrawingUsesFontLeading;
CGSize size = [text boundingRectWithSize:CGSizeMake(maxWidth, CGFLOAT_MAX) options:options context:nil].size;
@erikhazzard
erikhazzard / gist:af39b59b2e6b8255bde2
Last active December 16, 2015 20:12
Mixpanel set avatar image URL
$('#userlist_wrapper .grid_row').each(function(i, el){
var el = $(el);
var id = el.attr('data-distinct_id');
$('.avatar_cell img', el).attr(
'src',
'YOUR_URL_FOR_IMAGE/' + id + '.gif'
);
})