Skip to content

Instantly share code, notes, and snippets.

View JesseScott's full-sized avatar
💭
trying to decide what to focus on

Jesse Scott JesseScott

💭
trying to decide what to focus on
View GitHub Profile
@jsumners
jsumners / UIApplication+iPhoneVersion.h
Created November 2, 2012 18:38
A category on UIApplication for determining the iPhone device
#import <UIKit/UIKit.h>
#define IS_IPHONE (!IS_IPAD)
#define IS_IPAD (UI_USER_INTERFACE_IDIOM() != UIUserInterfaceIdiomPhone)
/**
Provides a few methods to determine what sort of device the application is
running on. Specifically, the methods make it easy to determine what sort of
iPhone resolution is available: `[[UIApplication sharedApplication] isIphone3]`
*/
@thuytrinh
thuytrinh / MainActivity.java
Last active September 21, 2020 01:22
Create carousel view with ViewPager
package com.thuytrinh.cardselectordemo;
import android.os.Bundle;
import android.support.v4.view.PagerAdapter;
import android.support.v4.view.ViewPager;
import android.support.v4.view.ViewPager.OnPageChangeListener;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.app.Activity;
@unbracketed
unbracketed / export_repo_issues_to_csv.py
Last active August 3, 2023 18:13
Export Issues from Github repo to CSV (API v3)
"""
Exports Issues from a specified repository to a CSV file
Uses basic authentication (Github username + password) to retrieve Issues
from a repository that username has access to. Supports Github API v3.
"""
import csv
import requests
@iamcam
iamcam / gist:3189094
Created July 27, 2012 16:48
Image Picker Rotation
-(void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info {
NSLog(@"Info: %@", info);
UIImage *img = [info objectForKey:UIImagePickerControllerEditedImage];
UIImage* originalImg = [self scaleAndRotateImage:[info objectForKey:UIImagePickerControllerOriginalImage]];
/*** OPTION 1 - JUST USE THE "FULL SIZE" IMAGE FROM THE PICKER CONTROLLER ***/
// [self usePhoto:originalImg];
@RobGThai
RobGThai / KML Snippet
Created July 23, 2012 10:34
Snippet code for parsing KML file from Google Maps
/**
* Retrieve navigation data set from either remote URL or String
* @param url
* @return navigation set
*/
public static NavigationDataSet GetNavigationDataSet(String url) {
NavigationDataSet navigationDataSet = null;
try
{
@visnup
visnup / lock.css
Created May 5, 2012 20:31
"lock" orientation of a website for mobile (iPad, iPhone)
/* if portrait mode is detected, rotate the entire site -90 degrees to hint rotating to landscape */
@media (orientation: portrait) {
body {
-webkit-transform: rotate(-90deg);
-moz-transform: rotate(-90deg);
-o-transform: rotate(-90deg);
-ms-transform: rotate(-90deg);
transform: rotate(-90deg);
}
}
@barraponto
barraponto / git-submodule-rm.sh
Created April 25, 2012 16:36
git submodule-rm
#!/bin/bash
function actual_path() {
if [ [ -z "$1" ] -a [ -d $1 ] ]; then
echo $(cd $1 && test `pwd` = `pwd -P`)
return 0
else
return 1
fi
}
@robnyman
robnyman / localStorage-canvas-data-url.js
Created February 21, 2012 08:39
Use localStorage and canvas to same image as a Data URL
// localStorage with image
var storageFiles = JSON.parse(localStorage.getItem("storageFiles")) || {},
elephant = document.getElementById("elephant"),
storageFilesDate = storageFiles.date,
date = new Date(),
todaysDate = (date.getMonth() + 1).toString() + date.getDate().toString();
// Compare date and create localStorage if it's not existing/too old
if (typeof storageFilesDate === "undefined" || storageFilesDate < todaysDate) {
// Take action when the image has loaded
@robnyman
robnyman / image-noscript.html
Created February 21, 2012 08:35
Image with noscript fallback
<figure>
<img id="elephant" src="about:blank" alt="A close up of an elephant">
<noscript>
<img src="elephant.png" alt="A close up of an elephant">
</noscript>
<figcaption>A mighty big elephant, and mighty close too!</figcaption>
</figure>
@robnyman
robnyman / image-data-url-localStorage.js
Created February 21, 2012 08:29
Turn image into Data URL and save in localStorage
// Get a reference to the image element
var elephant = document.getElementById("elephant");
// Take action when the image has loaded
elephant.addEventListener("load", function () {
var imgCanvas = document.createElement("canvas"),
imgContext = imgCanvas.getContext("2d");
// Make sure canvas is as big as the picture
imgCanvas.width = elephant.width;