This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Integer | |
def to_minutes | |
min = (self / 60.floor) | |
sec = (self - (min * 60)).round | |
"%0-2d:%0-2d" % [min, sec] | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Titanium Mobile Utility Functions | |
* | |
* @author Joshua Priddle <jpriddle@nevercraft.net> | |
* @version 0.0.0 | |
*/ | |
var $ = {}; | |
/** |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* jQuery Time Helpers | |
* | |
* @author Joshua Priddle <jpriddle@nevercraft.net> | |
* @copyright Copyright (c) 2010, ViaTalk, LLC | |
* @version 0.0.1 | |
*/ | |
;(function($) { | |
$.toTimestamp = function(seconds) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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: | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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"); |