Skip to content

Instantly share code, notes, and snippets.

Avatar

Rikard Hassel rikardhassel

View GitHub Profile
View gist:9f97a20ca74f9200be4f
private $_link = null;
/**
* Private function connect()
* This function is the basic code for the call to mySQLi. Returns a link to server.
* @return object
*/
private function connect()
{
if ( $this->_link === null )
View gist:616d6694474baa0e5f0f
/**
* Private function connect()
* This function is the basic code for the call to mySQLi. Returns a link to server.
* @return object
*/
private function connect()
{
$link = new mysqli( $GLOBALS['db_host'], $GLOBALS['db_user'], $GLOBALS['db_pass'], $GLOBALS['db_db'] ) or die( mysqli_error( $link ) );
$link->set_charset( 'utf8' );
@rikardhassel
rikardhassel / gist:11183389
Created Apr 22, 2014
Wordpress Mobile Detection (Excluding iPad)
View gist:11183389
function my_wp_is_mobile() {
static $is_mobile;
if ( isset($is_mobile) )
return $is_mobile;
if ( empty($_SERVER['HTTP_USER_AGENT']) ) {
$is_mobile = false;
} elseif (
strpos($_SERVER['HTTP_USER_AGENT'], 'Android') !== false
View gist:8397283
Problem 1
- suncat/mobile-detect-bundle dev-master requires mobiledetect/mobiledetectlib 2.7.* -> satisfiable by mobiledetect/mobiledetectlib[2.7.6, 2.7.0, 2.7.1, 2.7.2, 2.7.3, 2.7.4, 2.7.5].
- suncat/mobile-detect-bundle dev-master requires mobiledetect/mobiledetectlib 2.7.* -> satisfiable by mobiledetect/mobiledetectlib[2.7.6, 2.7.0, 2.7.1, 2.7.2, 2.7.3, 2.7.4, 2.7.5].
- Can only install one of: mobiledetect/mobiledetectlib[dev-master, 2.7.6].
- Can only install one of: mobiledetect/mobiledetectlib[dev-master, 2.7.0].
- Can only install one of: mobiledetect/mobiledetectlib[dev-master, 2.7.1].
- Can only install one of: mobiledetect/mobiledetectlib[dev-master, 2.7.2].
- Can only install one of: mobiledetect/mobiledetectlib[dev-master, 2.7.3].
- Can only install one of: mobiledetect/mobiledetectlib[dev-master, 2.7.4].
- Can only install one of: mobiledetect/mobiledetectlib[dev-master, 2.7.5].
View gist:7766727
return $(".pop-listfriend > div").removeClass("hide"), $(".pop-listfriend > div").addClass("hide"), $(".pop-listfriend > div.listAll").removeClass("hide"), !1
@rikardhassel
rikardhassel / compress.sh
Created Oct 18, 2013
Compresses the subdirectories of a specified directory.
View compress.sh
#!/bin/bash
find . -maxdepth 1 -type d -not -path "." -exec tar -zcvf {}.tar.gz {} \;
View keyrepeat.shell
# Mac OS X Lion introduced a new, iOS-like context menu when you press and hold a key
# that enables you to choose a character from a menu of options. If you are on Lion
# try it by pressing and holding down 'e' in any app that uses the default NSTextField
# for input.
#
# It's a nice feature and continues the blending of Mac OS X and iOS features. However,
# it's a nightmare to deal with in Sublime Text 2 if you're running Vintage (Vim) mode,
# as it means you cannot press and hold h/j/k/l to move through your file. You have
# to repeatedly press the keys to navigate.
View BusinessHours.class.php
/**
*
* Everyday hours shortcode handler.
* See https://github.com/MZAWeb/business-hours-plugin/wiki/Shortcodes
*
* @param $atts
*
* @return mixed|null
*/
public function shortcode_table( $atts ) {
View gist:5419683
<script type="text/javascript" src="json2.js"></script>
<script type="text/javascript" src="easyXDM.js"></script>
<script type="text/javascript">
var socket = new easyXDM.Socket({
onReady: function(){
socket.postMessage(document.body.scrollHeight)
}
});
</script>
You can’t perform that action at this time.