Skip to content

Instantly share code, notes, and snippets.

@joeykrim
joeykrim / gist:5dbd7a685b8d057182e4
Created Jun 11, 2015
AdMob Mediation Workaround for Smart Banner Ad Types
View gist:5dbd7a685b8d057182e4
//Constants for tablet sized ads (728x90)
//AdMob name: LEADERBOARD
final int IAB_LEADERBOARD_WIDTH = 728;
final int IAB_LEADERBOARD_HEIGHT = 90;
//AdMob name: FULL_BANNER
final int MED_BANNER_WIDTH = 480;
final int MED_BANNER_HEIGHT = 60;
//Constants for phone sized ads (320x50)
//AdMob name: BANNER
final int BANNER_AD_WIDTH = 320;
@joeykrim
joeykrim / gist:ba58ae2f82d586523786
Last active Aug 29, 2015
PHP Pagination - For Loops
View gist:ba58ae2f82d586523786
//Before
for($i = $pagenum-4; $i < $pagenum; $i++){
if($i > 0){
$paginationCtrls .= '<a href="'.$_SERVER['PHP_SELF'].'?pn='.$i.'">'.$i.'</a> &nbsp; ';
}
}
//After
for ($i = max($page_number - 4, 1); $i < $page_number; $i++) {
$paginationCtrls .= '<a href="' . $_SERVER['PHP_SELF'] . '/page/' . $i . '">' . $i . '</a> &nbsp; ';
}
@joeykrim
joeykrim / gist:3ef874119a0fbed7b90b
Last active Aug 29, 2015
PHP Pagination - Navigation Improvement
View gist:3ef874119a0fbed7b90b
// If over 6 pages away from the first page, add a quick link to the first page
if ($page_number > 6) {
$paginationCtrls .= '<a href="' . $_SERVER['PHP_SELF'] . '/page/1">1</a> &nbsp; ... &nbsp; ';
}
// If over 5 pages away from the last page, add a quick link to the last page
if ($page_number < $last_page - 5) {
$paginationCtrls .= ' ... &nbsp; <a href="' . $_SERVER['PHP_SELF'] . '/page/' . $last_page . '">' . $last_page . '</a> &nbsp; ';
}
@joeykrim
joeykrim / WhatsNewDialog.java
Created Aug 27, 2012 — forked from koush/poop.java
Whats New Dialog with Follow on Twitter Button
View WhatsNewDialog.java
//Credits:
//http://www.helloandroid.com/tutorials/how-display-custom-dialog-your-android-application
//https://gist.github.com/3087486
private void whatsNewDialog() {
//requestWindowFeature(Window.FEATURE_NO_TITLE);
//Dialog dialog = new Dialog(main.this);
final Dialog dialog = new Dialog(this, R.style.NoTitleDialog);
dialog.setContentView(R.layout.whatsnew);
//dialog.setTitle(getString(R.string.app_name) + " v" + currentAppVersion);
dialog.setCancelable(false);