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
remove blank lines notepad++: | |
To get your lines not to be joined together you have to search for \r\n\r\n and replace with \r\n |
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
Ctrl + W is the shortcut for searching. After entering the search term, press Enter. | |
To repeat the search, issue Alt + W. In this menu, you can select earlier searches using the arrow up/ down keys. | |
To toggle backwards searching, you need to press Alt + B in the search dialog. | |
For more shortcuts, press F1 |
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
nano /usr/share/nano/php.nanorc | |
syntax "php" "\.php|\.inc$" | |
color white start="<\?(php)?" end="\?>" | |
color magenta start="<[^\?]" end="[^\?]>" | |
color magenta "\$[a-zA-Z_0-9]*" | |
color brightblue "\->[a-zA-Z_0-9]*" | |
color cyan "(\[)|(\])" | |
color brightyellow "(var|class|function|echo|case|break|default|exit|switch|if|else|elseif|@|while|return|public|private|proteted|static)\s" | |
color brightyellow "\<(try|throw|catch|operator|new)\>" |
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
First, protect the web interface port so that it cannot be accessed from the outside world. | |
You can use iptables to block the port as follows: | |
sudo iptables -A INPUT -i eth0 -p tcp --dport 8080 -j DROP | |
sudo iptables -I INPUT -i eth0 -s 127.0.0.1 -p tcp --dport 8080 -j ACCEPT | |
Note: You may have to replace eth0 and 8080 above if you are using another interface. | |
SOCKS proxy setup | |
Once you block the web interface port, the easiest way to access it is to use ssh to set up a socks proxy. |
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
sshd (the server) closes the connection if it doesn't hear anything from the client for a while. | |
You can tell your client to send a sign-of-life signal to the server once in a while. | |
The configuration for this is in the file ~/.ssh/config. | |
To send the signal every four minutes to remotehost, put the following in your ~/.ssh/config. | |
Host remotehost | |
HostName remotehost.com |
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 | |
/** | |
* Formats a JSON string for pretty printing | |
* | |
* @param string $json The JSON to make pretty | |
* @param bool $html Insert nonbreaking spaces and <br />s for tabs and linebreaks | |
* @return string The prettified output | |
* @author Jay Roberts | |
*/ |
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 | |
class AbstractManagerBase extends \PHPUnit_Framework_TestCase | |
{ | |
protected function getEmMock() | |
{ | |
$emMock = $this->getMock('\Doctrine\ORM\EntityManager', | |
array('getRepository', 'getClassMetadata', 'persist', 'flush'), array(), '', false); | |
$emMock->expects($this->any()) | |
->method('getRepository') |
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
function getRandomInt(min, max) { | |
return Math.floor(Math.random() * (max - min)) + min; | |
} | |
/* | |
Code example explaining the enter, update and exit states in D3. | |
The 3 states basically define the actions that occur when data is added to a selection of elements. | |
Say if we were selecting data from a database where we had to perform a search with a query string, | |
each time we ran query the number of rows returned could be more, less, or could be the same but | |
contain different data, these in essence are the 3 states. more = enter, less = exit, same = update. |
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
public function downloadCsvAction() | |
{ | |
$oldTimeLimit = ini_get('max_execution_time'); | |
ini_set('max_execution_time', 60); | |
$lang = $this->params('lang', "en"); | |
$this->setRatingsViewData($this->viewData, $lang); | |
$headers = array( | |
'location_name', | |
'breakdown_period', |
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
<div id="chart"> | |
<h4>Percent of adults over 25 with at least a bachelor's degree:</h4> | |
<p><strong>Median:</strong> <span class="median"></span></p> | |
<small>Source: <cite><a href="http://census.gov">U.S. Census Bureau</a></cite>, via <cite><a href="http://beta.censusreporter.org/compare/01000US/040/table/?release=acs2011_1yr&table=B15003">Census Reporter</a></cite></small> | |
</div> |
OlderNewer