Skip to content

Instantly share code, notes, and snippets.

@chuckleplant
chuckleplant / google-locs-geotagger.py
Last active October 8, 2023 20:20
Little script that will automatically add GPS data to Jpeg images based on your Google location history, you can get it from https://takeout.google.com/
import os
import glob
import argparse
import json
import datetime
import time
from bisect import bisect_left, bisect_right
from PIL import Image
from pexif import JpegFile
@dominicfallows
dominicfallows / mamp-db-backup.sh
Last active March 28, 2022 00:56
Bash shell script to backup MAMP databases to individual files (for MAMP with MySQL 5.6+)
#!/bin/bash
#
# Description: Shell script to backup all MAMP MySQL databases into compressed files
# Script: mamp-db-backup.sh
# Version: 1.0.1
# Script Website: https://gist.github.com/dominicfallows/c1f7bd150f946b7d1dfd1a720a13f8fc
# Author: Dominic Fallows
# Author Website: https://gist.github.com/dominicfallows
#
# Requirements:
@hartzis
hartzis / EventComponent.js
Last active November 29, 2023 16:38
Touch Event Handling React Component
import React from 'react';
export default class EventComponent extends React.Component {
constructor(props) {
super(props);
this._onTouchStart = this._onTouchStart.bind(this);
this._onTouchMove = this._onTouchMove.bind(this);
this._onTouchEnd = this._onTouchEnd.bind(this);
@KonradIT
KonradIT / Hero4BlackWifi.md
Last active April 8, 2025 10:27
Wifi hacking for HERO4 Black
@stilist
stilist / gist:cd7fdfabbf9ec5ed89b7
Created July 3, 2014 21:46
Installing OpenCV on OS X (using Homebrew)

Based on http://jjyap.wordpress.com/2014/02/21/installing-opencv-2-4-8-on-mac-osx-with-python-support/

  1. edit .bashrc or .bash_profile to include: export PATH="/Library/Frameworks/Python.framework/Versions/Current/bin:/Library/Python/2.7/site-packages/:$PATH"
  2. brew update
  3. brew tap homebrew/science
  4. brew install opencv
  5. cd /Library/Python/2.7/site-packages/
  6. ln -s /usr/local/Cellar/opencv/2.4.9/lib/python2.7/site-packages/cv.py cv.py
  7. ln -s /usr/local/Cellar/opencv/2.4.9/lib/python2.7/site-packages/cv2.so cv2.so
@scottjehl
scottjehl / noncritcss.md
Last active August 12, 2023 16:57
Comparing two ways to load non-critical CSS

I wanted to figure out the fastest way to load non-critical CSS so that the impact on initial page drawing is minimal.

TL;DR: Here's the solution I ended up with: https://github.com/filamentgroup/loadCSS/


For async JavaScript file requests, we have the async attribute to make this easy, but CSS file requests have no similar standard mechanism (at least, none that will still apply the CSS after loading - here are some async CSS loading conditions that do apply when CSS is inapplicable to media: https://gist.github.com/igrigorik/2935269#file-notes-md ).

Seems there are a couple ways to load and apply a CSS file in a non-blocking manner:

@WebEndevSnippets
WebEndevSnippets / style.css
Last active April 18, 2018 12:08
Gravity Forms: 4 Column CSS
/* 4 column Gravity Forms custom ready class ------------------------------------------------------*/
.gform_wrapper .top_label li.gfield.gf_first_quarter,
.gform_wrapper .top_label li.gfield.gf_second_quarter,
.gform_wrapper .top_label li.gfield.gf_third_quarter,
.gform_wrapper .top_label li.gfield.gf_fourth_quarter {
margin:0 0 8px 0;
width:24%;
}
@bcantoni
bcantoni / friends.php
Last active July 12, 2022 21:46
Use Twitter API to export data (in CSV format) on people you are following. See Installation notes for steps. Prerequisites: 1) Twitter OAuth PHP library 2) Create your own Twitter application and OAuth keys/tokens.
<?php
/* friends.php - use Twitter API to export data (CSV format) on people you are following
Installation:
1. Install Twitter OAuth PHP library (https://github.com/abraham/twitteroauth)
2. Adjust twitteroauth.php include path below
3. Create Twitter application (https://dev.twitter.com/apps)
4. Fill in 4 Twitter app keys below
5. Adjust $fields array if you want different fields saved
@mhawksey
mhawksey / gist:1442370
Last active February 1, 2025 00:36
Google Apps Script to read JSON and write to sheet
function getJSON(aUrl,sheetname) {
//var sheetname = "test";
//var aUrl = "http://pipes.yahoo.com/pipes/pipe.run?_id=286bbb1d8d30f65b54173b3b752fa4d9&_render=json";
var response = UrlFetchApp.fetch(aUrl); // get feed
var dataAll = JSON.parse(response.getContentText()); //
var data = dataAll.value.items;
for (i in data){
data[i].pubDate = new Date(data[i].pubDate);
data[i].start = data[i].pubDate;
}