This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function strip_word_html($text, $allowed_tags = '<b><i><sup><sub><em><strong><u><br>') | |
{ | |
mb_regex_encoding('UTF-8'); | |
//replace MS special characters first | |
$search = array('/‘/u', '/’/u', '/“/u', '/”/u', '/—/u'); | |
$replace = array('\'', '\'', '"', '"', '-'); | |
$text = preg_replace($search, $replace, $text); | |
//make sure _all_ html entities are converted to the plain ascii equivalents - it appears | |
//in some MS headers, some html entities are encoded and some aren't |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var CleanWordHTML = function ( str ) | |
{ | |
str = str.replace(/<o:p>\s*<\/o:p>/g, "") ; | |
str = str.replace(/<o:p>.*?<\/o:p>/g, " ") ; | |
str = str.replace( /\s*mso-[^:]+:[^;"]+;?/gi, "" ) ; | |
str = str.replace( /\s*MARGIN: 0cm 0cm 0pt\s*;/gi, "" ) ; | |
str = str.replace( /\s*MARGIN: 0cm 0cm 0pt\s*"/gi, "\"" ) ; | |
str = str.replace( /\s*TEXT-INDENT: 0cm\s*;/gi, "" ) ; | |
str = str.replace( /\s*TEXT-INDENT: 0cm\s*"/gi, "\"" ) ; | |
str = str.replace( /\s*TEXT-ALIGN: [^\s;]+;?"/gi, "\"" ) ; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
check process redis-server | |
with pidfile "/var/run/redis.pid" | |
start program = "/etc/init.d/redis-server start" | |
stop program = "/etc/init.d/redis-server stop" | |
if 2 restarts within 3 cycles then timeout | |
if totalmem > 100 Mb then alert | |
if children > 255 for 5 cycles then stop | |
if cpu usage > 95% for 3 cycles then restart | |
if failed host 127.0.0.1 port 6379 then restart | |
if 5 restarts within 5 cycles then timeout |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if (typeof RedactorPlugins === 'undefined') var RedactorPlugins = {}; | |
RedactorPlugins.twitter = function () { | |
return { | |
init: function () { | |
var that = this; | |
var callback = $.proxy(function () { | |
var tweet_url = $('#tweet_url').val(); | |
$.get('https://api.twitter.com/1/statuses/oembed.json', { | |
url: tweet_url, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
To install redis from debian backports we need to add the backports sources. | |
1. Add to /etc/apt/sources.list: | |
deb http://backports.debian.org/debian-backports squeeze-backports main | |
2. Retrieve debian key | |
$ gpg --keyserver pgp.mit.edu --recv-keys AED4B06F473041FA |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
upstream myapp { | |
server 127.0.0.1:8081; | |
} | |
limit_req_zone $binary_remote_addr zone=login:10m rate=1r/s; | |
server { | |
listen 443 ssl spdy; | |
server_name _; | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## SSH - Remote export > local import | |
ssh USER@HOST mysqldump -uREMOTEDATABASEUSER -pREMOTEDATABASEPASSWORD -hREMOTEHOST REMOTEDATABASENAME | mysql -uLOCALDATABASEUSER -pLOCALDATABASEPASSWORD LOCALDATABASENAME | |
## Export to CSV | |
mysql -uUSER -pPASS DATABASENAME -B -e "select * from \`korisnici\`;" | sed 's/\t/","/g;s/^/"/;s/$/"/;s/\n//g' > filename.csv | |
## Export to CSV 2 | |
mysql -uUSER -pPASS DATABASE -B -e "SELECT users.uid AS 'ID', users.name AS 'Username', users.mail AS 'Email', from_unixtime(users.created) AS 'Created', from_unixtime(users.login) AS 'Last login' FROM users WHERE users.status=1 AND users.login!=0 ORDER BY users.login DESC;" | sed "s/'/\'/;s/\t/\",\"/g;s/^/\"/;s/$/\"/;s/\n//g" > vehicle_categories.csv | |
## Export to SQL gzipped file with compression |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
angular.module('starter', ['ionic', 'starter.controllers', 'starter.services',]) | |
.run(function ($ionicPlatform, $cordovaBatteryStatus, $ionicLoading) { | |
$ionicPlatform.ready(function () { | |
// Hide the accessory bar by default (remove this to show the accessory bar above the keyboard | |
// for form inputs) | |
if (window.cordova && window.cordova.plugins.Keyboard) { | |
cordova.plugins.Keyboard.hideKeyboardAccessoryBar(true); |