Skip to content

Instantly share code, notes, and snippets.

@jlefler
jlefler / OptionalSelectionSpinnerAdapter.java
Created October 27, 2014 23:24
Spinner Adapter helper that allows for a first option not in the underlying adapter. I use it to have a "None" option for spinners backed by CursorAdapters. Simplified to use standard styles and based on the answer HRJ provided at http://stackoverflow.com/questions/867518/how-to-make-an-android-spinner-with-initial-text-select-one
package com.joshlefler.statelaw.ui;
import android.content.Context;
import android.database.DataSetObserver;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ListAdapter;
import android.widget.SpinnerAdapter;
import android.widget.TextView;
@tripflex
tripflex / gist:e964bd36a6d95341859e
Created October 22, 2014 23:28
bash/shell progress function
process_progress() {
[ -z $1 ] && exit 0
PROGRESS=(". " " .. " " ... " " .. " " ." " .. " " ... " " .. ")
COUNTER=0
echo -n "$2 "
while `ps -p $1 > /dev/null`; do
[ $COUNTER -eq 8 ] && COUNTER=0
echo -n "${PROGRESS[$COUNTER]}"
echo -n " Running "
sleep 0.5
@zackjp
zackjp / README.md
Last active November 19, 2019 02:00
Simple Git deploy script for PHP apps

Simple Git deploy script for PHP apps

Usage

SSH into your server then copy deploy.sh, deploy.json, and deploy_post_hook.sh.

git clone https://gist.github.com/8816795.git

Then set your configs in json and run:

@jo
jo / js-crypto-libraries.md
Last active May 21, 2025 02:55
List of JavaScript Crypto libraries.

JavaScript Crypto Libraries

List some crypto libraries for JavaScript out there. Might be a bit out dated. Scroll to the bottom.

WebCryptoAPI

http://www.w3.org/TR/WebCryptoAPI/

This specification describes a JavaScript API for performing basic cryptographic operations in web applications, such as hashing, signature generation and verification, and encryption and decryption. Additionally, it describes an API for applications to generate and/or manage the keying material necessary to perform these operations. Uses for this API range from user or service authentication, document or code signing, and the confidentiality and integrity of communications.

@christopher-hopper
christopher-hopper / clone-mysql-db.sh
Last active January 15, 2021 17:16
Clone a MySQL database to a new database on the same server without using a dump file. This is much faster than using mysqldump.
#!/bin/bash
DBUSER="root";
DBPASS="";
DBHOST="localhost";
DB_OLD=mydatabase
DB_NEW=clone_mydatabase
DBCONN="--host=${DBHOST} --user=${DBUSER} --password=${DBPASS}";

Content

Content is created by putting data into a template. In this case, the data is information, and the template is how that information is displayed. Each data and template are also given a title and tags to make them easier to manage and organize. A title makes something easy to identify, and tags make something easy to group.

In this system, the markup languages of JSON is used to describe the data and the template.

Here is an example of a JSON template file named template.json:

{
@pognon
pognon / AndroidManifest.xml
Last active March 13, 2022 15:16
NFC Demo
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="fr.ippon.mobile.nfcdemo"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="14"
android:targetSdkVersion="15" />
@brandonb927
brandonb927 / osx-for-hackers.sh
Last active July 16, 2025 15:20
OSX for Hackers: Yosemite/El Capitan Edition. This script tries not to be *too* opinionated and any major changes to your system require a prompt. You've been warned.
#!/bin/sh
###
# SOME COMMANDS WILL NOT WORK ON macOS (Sierra or newer)
# For Sierra or newer, see https://github.com/mathiasbynens/dotfiles/blob/master/.macos
###
# Alot of these configs have been taken from the various places
# on the web, most from here
# https://github.com/mathiasbynens/dotfiles/blob/5b3c8418ed42d93af2e647dc9d122f25cc034871/.osx