Skip to content

Instantly share code, notes, and snippets.

@pykotechguy
pykotechguy / notes_php_centos6_drupal.md
Created September 23, 2014 16:08
CentOS 6 on digitalocean

CentOS 6 on digitalocean

  1. create a new virtualhosts directory, this where you put all your virtualhosts.

PHP stuff:

  • php-gd
  • php-mbstring
@pykotechguy
pykotechguy / logger.php
Created September 20, 2014 16:58
sample ip address logging class
<?php
class Logger {
public $db;
public function __construct() {
$this->db = $this->_conn('localhost','root','root','stats');
}
private function _conn($dbhost, $user,$pwd, $db) {
try {
return mysqli_connect($dbhost,$user,$pwd,$db);
@pykotechguy
pykotechguy / xampp.py
Created July 31, 2014 08:12
Start Xampp using python
import os
os.system("/Applications/XAMPP/xamppfiles/xampp start")
@pykotechguy
pykotechguy / cakephp_phpmailer.php
Created July 18, 2014 10:01
CakePHP EmailerComponent SMTP
<?php
// /vendors/phpmailer/class.phpmail.php ->
// add a variable named SMTPSecure - SSL / TLS
var $SMTPSecure
// line 542
if(!empty($this->SMTPSecure))
{
$secure = $this->SMTPSecure . '://';
}
@pykotechguy
pykotechguy / export_save_html.js
Created July 17, 2014 10:39
Exporting to CSV using Javascript
function exportSaveHtml(dhtml) {
window.open('data:application/csv;charset=utf-8,' + encodeURI(dhtml));
}
/* jqModal base Styling courtesy of;
Brice Burgess <[email protected]> */
/* The Window's CSS z-index value is respected (takes priority). If none is supplied,
the Window's z-index value will be set to 3000 by default (via jqModal.js). */
.jqmWindow {
/* display: none; Normally you want to display:none to avoid a FOUC, but this causes problems if there is a Facebook like button in the overlay (it will not display on some browsers. So, we use visibility:hidden instead and adapt the launch script accordingly */
visibility:hidden;
@pykotechguy
pykotechguy / hideModal.js
Created June 3, 2014 11:33
Function hide modal by #id
function hideModal(modalId) {
document.getElementById(modalId).innerHTML = ""; //('slow');
}
@pykotechguy
pykotechguy / on_escape_close_bbmodal.js
Created May 29, 2014 05:29
escape key press closes your modal float
$(document).keyup(function(e) {
if (e.keyCode == 27) {
view.modalClose();
}
});
// then in your backbone view
//...
modalClose: function() {
function GetWidth()
{
var x = 0;
if (self.innerHeight) {
x = self.innerWidth;
} else if (document.documentElement && document.documentElement.clientHeight){
x = document.documentElement.clientWidth;
} else if (document.body){
x = document.body.clientWidth;
}