This file contains hidden or 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
| float InvSqrt (float x){ | |
| float xhalf = 0.5f*x; | |
| int i = *(int*)&x; | |
| i = 0x5f3759df - (i>>1); | |
| x = *(float*)&i; | |
| x = x*(1.5f - xhalf*x*x); | |
| return x; | |
| } |
This file contains hidden or 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
| require 'open-uri' | |
| # url dsl -- the ultimate url dsl! | |
| # | |
| # You just can't beat this: | |
| # | |
| # $ irb -r url_dsl | |
| # >> include URLDSL | |
| # => Object | |
| # >> http://github.com/defunkt.json |
This file contains hidden or 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
| /* `Rounded Corners | |
| ----------------------------------------------------------------------------------------------------*/ | |
| .round_all { | |
| -khtml-border-radius: 5px; | |
| -moz-border-radius: 5px; | |
| -webkit-border-radius: 5px; | |
| border-radius: 5px; | |
| } |
This file contains hidden or 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
| /* css to make <div id="new">NEW</div> into this: http://bit.ly/5sf4sq */ | |
| #new { | |
| display:block; | |
| width:40px; | |
| height:30px; | |
| padding-top:10px; | |
| background-color:#F72F3C; | |
| color:white; | |
| text-align:center; |
This file contains hidden or 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
| // rotates elements | |
| // requires prototype.js | |
| (function (){ | |
| var total = 4; | |
| var i = 1; // counter | |
| var pre = 'news-text-'; // the prefix for the name of the element id | |
| var time = 5; // seconds | |
| setInterval(function(){ | |
| for(c=1; c<total; c++){ |
This file contains hidden or 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 | |
| /** | |
| * This function just adds a question mark at the end of a string, in a semi-smart way. Should work in most cases. | |
| * @author Paul Thrasher (@thrashr888) | |
| * @date 3/18/2010 | |
| */ | |
| function format_question($text, $end = "?"){ | |
| $text = ucfirst(trim($text)); | |
This file contains hidden or 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 | |
| /** | |
| * SplClassLoader implementation that implements the technical interoperability | |
| * standards for PHP 5.3 namespaces and class names. | |
| * | |
| * http://groups.google.com/group/php-standards/web/final-proposal | |
| * | |
| * // Example which loads classes for the Doctrine Common package in the | |
| * // Doctrine\Common namespace. |
This file contains hidden or 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
| set :application, "wishcraftdesign" | |
| set :project_name, "wishcraft" | |
| set :application_url, "http://wishcraftdesign.com/site/" | |
| set :scm, :git | |
| set :repository, "git@github.com:thrashr888/Wish-craft.com.git" | |
| set :user, "thrashr888" # your GitHub username | |
| set :scm_passphrase, "xxxxxxxx" # your GitHub password | |
| set :use_sudo, false |
This file contains hidden or 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
| // ========================= | |
| // SetInterval | |
| // ========================= | |
| // While not truly accurate, setInterval is still fairly good, time-wise. | |
| // Better for things like a "one second tick" but not great for expensive | |
| // code executed at small intervals as iterations can "stack". | |
| // (ECMAScript 5 strict mode compatible) |
This file contains hidden or 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
| /** | |
| * from Secrets of the JavaScript Ninja by John Resig | |
| * Example: | |
| * | |
| * var hello = tmpl("Hello, <%= name %>!"); | |
| * alert(hello({name: "world"})); | |
| */ | |
| (function() { | |
| var cache = {}; | |
| this.tmpl = function tmpl(str, data) { |