Skip to content

Instantly share code, notes, and snippets.

View joshdholtz's full-sized avatar
👨‍👩‍👦
Family first then OSS

Josh Holtz joshdholtz

👨‍👩‍👦
Family first then OSS
View GitHub Profile
@joshdholtz
joshdholtz / update_gitignore.sh
Last active February 12, 2021 13:01
Remove files from updated .gitignore
git ls-files -ci --exclude-standard -z | xargs -0 git rm --cached
### Alias in .zshrc or .bashrc because too hard to remember
# alias ungit="git ls-files -ci --exclude-standard -z | xargs -0 git rm --cached"
@joshdholtz
joshdholtz / SomeFragment.java
Last active December 22, 2022 09:41
Android Google Maps V2 - MapView in XML
public class SomeFragment extends Fragment {
MapView mapView;
GoogleMap map;
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View v = inflater.inflate(R.layout.some_layout, container, false);
private int id;
private String name;
private String description;
private double fee;
private int startAge;
private int endAge;
private int size;
private boolean adultOnly;
private int min;
private int max;
@joshdholtz
joshdholtz / Thing.java
Created January 22, 2013 21:40
Stuff and things for cookies and things
/**
* @param cookie the cookie to set
*/
public String setCookie(HttpResponse response, Context context) {
for (int i = 0; i < response.getAllHeaders().length; ++i) {
Log.d(Constants.LOG, response.getAllHeaders()[i].getName() + " - " + response.getAllHeaders()[i].getValue());
}
Header[] cookies = response.getHeaders("Set-Cookie");
if (cookies.length > 0) {
@joshdholtz
joshdholtz / controller.rb
Last active December 11, 2015 14:18
Sinatra - redirecting a user to a file stored in S3 with an authenticated url that expires in 5 minutes
get "/:filename" do
AWS::S3::Base.establish_connection!(
:access_key_id => ENV['S3_KEY'],
:secret_access_key => ENV['S3_SECRET'])
redirect AWS::S3::S3Object.url_for(params[:filename], ENV['S3_BUCKET'])
end
@joshdholtz
joshdholtz / to_s3_son.rb
Created February 6, 2013 01:25
Fileupload to s3
post "/" do
logger.debug "Params - " + params.to_s
photo = nil
caption = params[:caption]
params.each_value do |file|
unless file && file.is_a?(Hash) && (tmpfile = file[:tempfile]) && (name = file[:filename])
@joshdholtz
joshdholtz / AlertUtils.java
Created February 9, 2013 22:59
Manages alerts and dialogs in Android - Used to subclass out Activity for these methods but now that I use Fragment, FragmentActivity, and Activity this just seemed easier
import android.app.AlertDialog;
import android.app.ProgressDialog;
import android.content.Context;
import android.content.DialogInterface;
import java.util.HashMap;
import java.util.Map;
public class AlertUtils {
@joshdholtz
joshdholtz / Gemfile.lock
Created May 3, 2013 12:49
The Gemfile.lock that was causing weeeeeiirrrddd issues
GIT
remote: git://github.com/joshdholtz/html-pager.git
revision: 537e14e70f91b8fcfd7238f6e5dfd62a86c25a05
specs:
html_pager (0.0.2)
haml (>= 3.1.7)
GEM
remote: http://rubygems.org/
specs:
@joshdholtz
joshdholtz / ProtocolModel.h
Created May 7, 2013 20:45
ProtocolModel - too lazy to create a repo right now
//
// ProtocolModel.h
//
// Created by Josh Holtz on 2/5/13.
// Copyright (c) 2013 RokkinCat. All rights reserved.
//
#import <Foundation/Foundation.h>
@interface ProtocolModel : NSObject
@joshdholtz
joshdholtz / AndroidManifest.xml
Created July 24, 2013 15:34
Using Sentry-Android with a CaptureListener to show if using wifi - Screenshot of success http://i.imgur.com/bZ9qfXA.png
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.joshdholtz.sentry"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="8" />