Skip to content

Instantly share code, notes, and snippets.

View itspriddle's full-sized avatar
🤘
clickity clack

Joshua Priddle itspriddle

🤘
clickity clack
View GitHub Profile
<?php
function generate_password($length = 10)
{
$password = "";
$letters = array(
'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n',
'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', 'A', 'B',
'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P',
'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', '0', '1', '2', '3',
'4', '5', '6', '7', '8', '9'
My Old Cell Phone Usage
Received Calls: 24:24:39
Dialed Calls: 21:56:11
All Calls: 57:18:20
Transmit Data: 12,033 KB
Received Data: 9,743 KB
Total: 21,776 KB
class Integer
def to_minutes
min = (self / 60.floor)
sec = (self - (min * 60)).round
"%0-2d:%0-2d" % [min, sec]
end
end
/**
* Titanium Mobile Utility Functions
*
* @author Joshua Priddle <jpriddle@nevercraft.net>
* @version 0.0.0
*/
var $ = {};
/**
/**
* jQuery Time Helpers
*
* @author Joshua Priddle <jpriddle@nevercraft.net>
* @copyright Copyright (c) 2010, ViaTalk, LLC
* @version 0.0.1
*/
;(function($) {
$.toTimestamp = function(seconds) {
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="description" content="">
<title>CSS3 button example</title>
<link rel="stylesheet" href="css/reset.css" media="screen">
<style>
body {
background: #ddd;
@drichert
drichert / post-checkout
Created April 27, 2011 21:18
git post-checkout hook for compressing javascript (via uglifyjs)
#!/bin/bash
branch=$(git symbolic-ref -q HEAD |sed 's/refs\/heads\///')
gitroot=$(git rev-parse --show-toplevel)
jsdir="js"
targetdir="$gitroot/$jsdir"
files=$(find $targetdir -maxdepth 1 -type f -name '*.js' ! \( -name '*.min.js' \))
echo -n "Uglifying javascript... "
for f in $files; do
module AttrReaderWriter
def attr_reader_or_writer(*keys)
keys.flatten.each do |key|
class_eval <<-RUBY, __FILE__, __LINE__
def #{key}(val = nil)
@#{key} = val || @#{key}
end
RUBY
end
end
@itspriddle
itspriddle / gist:1106724
Created July 26, 2011 13:13
Ruby Style Guide
Original Source: https://github.com/chneukirchen/styleguide
= Christian Neukirchen's Ruby Style Guide
You may not like all rules presented here, but they work very well for
me and have helped producing high quality code. Everyone is free to
code however they want, write and follow their own style guides, but
when you contribute to my code, please follow these rules:
<?php
// Usage: Drop this script in _import and then run `php import.php`
// It will import posts from WordPress as markdown
// EDIT THESE
ini_set('date.timezone', 'America/New_York');
$con = mysql_connect('localhost', 'root', '');
$db = mysql_select_db('blog_test');
$q = mysql_query("SELECT * FROM blog_posts");