This file contains hidden or 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 hidden or 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
| /** | |
| * Get YouTube ID from various YouTube URL | |
| * @author: takien | |
| * @url: http://takien.com | |
| * For PHP YouTube parser, go here http://takien.com/864 | |
| */ | |
| function YouTubeGetID(url){ | |
| var ID = ''; | |
| url = url.replace(/(>|<)/gi,'').split(/(vi\/|v=|\/v\/|youtu\.be\/|\/embed\/)/); |
This file contains hidden or 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
| # | |
| # Slightly tighter CORS config for nginx | |
| # | |
| # A modification of https://gist.github.com/1064640/ to include a white-list of URLs | |
| # | |
| # Despite the W3C guidance suggesting that a list of origins can be passed as part of | |
| # Access-Control-Allow-Origin headers, several browsers (well, at least Firefox) | |
| # don't seem to play nicely with this. | |
| # |
This file contains hidden or 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
| # update | |
| sudo yum -y update | |
| sudo yum -y upgrade | |
| # enable EPEL6 by changing enabled=0 -> enabled=1 | |
| sudo vim /etc/yum.repos.d/epel.repo | |
| # install htop | |
| sudo yum install htop |
This file contains hidden or 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
| .visible-android { | |
| display:none; | |
| } | |
| .visible-ios { | |
| display:none; | |
| } | |
| .on-device .visible-android, .on-device .visible-android { | |
| display:inherit; | |
| } | |
| .device-ios .visible-android { |
This file contains hidden or 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 paragraphs = ['paragraph 1', 'paragraph 1']; | |
| var html = '<p>' + paragraphs.join('</p><p>') + '</p>'; |
This file contains hidden or 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
| // Adding counter | |
| db.counters.insert( | |
| { | |
| _id: "userid", | |
| seq: 0 | |
| } | |
| ); | |
| // function to add sequence | |
| function getNextSequence(name) { |
This file contains hidden or 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
| /* | |
| * Copyright 2014 Julian Shen | |
| * | |
| * Licensed under the Apache License, Version 2.0 (the "License"); | |
| * you may not use this file except in compliance with the License. | |
| * You may obtain a copy of the License at | |
| * | |
| * http://www.apache.org/licenses/LICENSE-2.0 | |
| * | |
| * Unless required by applicable law or agreed to in writing, software |
This file contains hidden or 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 | |
| session_start(); | |
| if (isset($_GET["locale"])) { | |
| $locale = $_GET["locale"]; | |
| } | |
| else if (isset($_SESSION["locale"])) { | |
| $locale = $_SESSION["locale"]; | |
| } | |
| else { |
This file contains hidden or 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
| // First, create a function that includes the path to your favicon | |
| function add_favicon() { | |
| $favicon_url = get_stylesheet_directory_uri() . '/images/icons/admin-favicon.ico'; | |
| echo '<link rel="shortcut icon" href="' . $favicon_url . '" />'; | |
| } | |
| // Now, just make sure that function runs when you're on the login page and admin pages | |
| add_action('login_head', 'add_favicon'); | |
| add_action('admin_head', 'add_favicon'); |