Skip to content

Instantly share code, notes, and snippets.

View og-shawn-crigger's full-sized avatar

Shawn Crigger og-shawn-crigger

View GitHub Profile
@og-shawn-crigger
og-shawn-crigger / socialmedia.php
Created April 6, 2012 02:42
Social Button Source Code Borrowed from http://html5bookmarks.com
<!-- Social Media Top Header Links -->
<div id="socialmedia">
<div id="socialfacebook">
<iframe src="http://www.facebook.com/plugins/like.php&amp;
href=<?= $site_url(); ?>&amp;send=false&amp;layout=button_count&amp;width=47&amp;
show_faces=false&amp;action=like&amp;colorscheme=light&amp;font&amp;
height=21&amp;locale=en_US"
style="border:none; overflow:hidden; width:47px; height:21px;">
</iframe>
@og-shawn-crigger
og-shawn-crigger / ci_uri_info.md
Created April 7, 2012 06:41
CodeIgniter Snippets - How to get Controller, Method and Module name - Router | URI Classes

CodeIgniter - Working with URL Params

Target a Specific Value

$this->uri->segment(n); // n=1 for controller, n=2 for method, etc

Using the Router Class

@og-shawn-crigger
og-shawn-crigger / maxsize.php
Created April 9, 2012 13:59
Get Max Upload Size from PHP ini's 'post_max_size' && 'upload_max_filesize'
<?php
//Simple Function to Get Max Upload Size from PHP
$max_upload = min(ini_get('post_max_size'), ini_get('upload_max_filesize'));
$max_upload = str_replace('M', '', $max_upload);
$max_upload = $max_upload * 1024;
@og-shawn-crigger
og-shawn-crigger / logsnippet.php
Created April 25, 2012 02:37
Bonfire Snippet for Console Logging with class/method name
<?php
// This one is my debugging snippet
if ( $this->_debug === TRUE )
{
Console::log('['. get_class($this) .': '. __METHOD__ .'] . 'replacementwithusefultext' );
}
//
@og-shawn-crigger
og-shawn-crigger / remove_orig.sh
Created April 29, 2012 06:00
Quick Find and Recursive Delete Files and Folders in BASH matching a pattern currently set as *.orig for GIT merges
find . -name *.orig.* -type f -exec rm {} \
@og-shawn-crigger
og-shawn-crigger / findandcombine.sh
Created April 30, 2012 23:36
CLI Command to Find and Combine Text Files
find ./src -name '*.txt' -exec cat '{}' \; > test.txt
//The above looks through everything in the ./src directory (including all subdirectories) for any files with the .txt //extension. Each file it finds, it adds to test.txt. So at the end of the command's run, all of the text files will be //combined together into text.txt. You can use this strategy to easily combine lots of files into one.
@og-shawn-crigger
og-shawn-crigger / ciloadertest.php
Created May 8, 2012 17:49
Check if library/class is loaded in Codeigniter
<?php
echo 'Currently loaded libs: '.implode(', ', $this->loader->_ci_classes());
@og-shawn-crigger
og-shawn-crigger / nojstojs.js
Created May 11, 2012 16:30
jQuery Snippet to Change no-js class to js
$(document).(ready(function () {
$(".no-js").addClass('js').removeClass('.no-js');
});
@og-shawn-crigger
og-shawn-crigger / pushup_css.css
Created May 11, 2012 17:15
CSS PushUp Like Effect
@font-face {font-family:"font";src:url("https://")}@media (touch-enabled),(-webkit-touch-enabled),(-moz-touch-enabled),(-o-touch-enabled),(-ms-touch-enabled),(modernizr){#touch{top:9px;position:absolute}}@media (transform-3d),(-webkit-transform-3d),(-moz-transform-3d),(-o-transform-3d),(-ms-transform-3d),(modernizr){#csstransforms3d{left:9px;position:absolute;height:3px;}}#generatedcontent:after{content:":)";visibility:hidden}
@og-shawn-crigger
og-shawn-crigger / scrolltop.js
Created May 11, 2012 17:41
Scroll top Top jQuery
<a name="top">
<a href="#top" class="scroll-totop">Top</a>
<script>
$('a[href=#top]').click(function(){
$('html, body').animate({scrollTop:0}, 'slow');