Skip to content

Instantly share code, notes, and snippets.

View rogerbuecker-snippets's full-sized avatar

rogerbuecker-snippets

View GitHub Profile
@rogerbuecker-snippets
rogerbuecker-snippets / gist:3878954
Created October 12, 2012 12:23
MIS: Stellenausschreibung
<tr>
<TD ALIGN="left" VALIGN="top">
<IMG SRC="../images/new13.gif" WIDTH="20" HEIGHT="15" BORDER="0" ALT="">
</TD>
<!-- <TD ALIGN="left" VALIGN="top" >
<IMG SRC="../images/robbikopf2.jpg" WIDTH="20" HEIGHT="17" BORDER="0" ALT="">
</TD>
-->
<TD ALIGN="left" VALIGN="top">
STANDORT
@rogerbuecker-snippets
rogerbuecker-snippets / gist:3878847
Created October 12, 2012 11:46
Wordpress: Smart Wordpress Maintenance Mode
<?php
/**
* Place this file in root of wordpress site to enable
* maintenance mode for users who are not logged in.
* Also, allows access to /wp-admin during maintenance
*
* Filename: .maintenance
*/
function is_user_logged_in() {
$loggedin = false;
@rogerbuecker-snippets
rogerbuecker-snippets / gist:3878841
Created October 12, 2012 11:45
Wordpress: Simple WordPress Footer Copyright
<?php _e( '&copy;&nbsp;' . date('Y') . '&nbsp;' ); bloginfo( 'name' ); ?>
@rogerbuecker-snippets
rogerbuecker-snippets / gist:3878840
Created October 12, 2012 11:45
Wordpress: Estimated reading time
<?php
$mycontent = $post->post_content; // wordpress users only
$word = str_word_count(strip_tags($mycontent));
$m = floor($word / 200);
$s = floor($word % 200 / (200 / 60));
$est = $m . ' minute' . ($m == 1 ? '' : 's') . ', ' . $s . ' second' . ($s == 1 ? '' : 's');
?>
<p>Estimated reading time: <?php echo $est; ?></p>
@rogerbuecker-snippets
rogerbuecker-snippets / gist:3878836
Created October 12, 2012 11:45
PHP: Short URL with Bit.ly
function get_short_link($url)
{
$bitly_login="yourloginname";
$bitly_apikey="yourapikey";
$api_call = file_get_contents("http://api.bit.ly/shorten?version=2.0.1&longUrl=".$url."&login=".$bitly_login."&apiKey=".$bitly_apikey);
$bitlyinfo=json_decode(utf8_encode($api_call),true);
if ($bitlyinfo['errorCode']==0)
{
return $bitlyinfo['results'][urldecode($url)]['shortUrl'];
}
@rogerbuecker-snippets
rogerbuecker-snippets / gist:3878771
Created October 12, 2012 11:25
JavaScript: Empty an Array
var myArray = ["one", "two", "three"];
// console.log( myArray ) => ["one", "two", "three"]
myArray.length = 0;
// console.log( myArray ) => []