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
1. Create a file at the webroot called whoami.php | |
2. Put this code in the whoami.php file and save it: | |
<?php echo `whoami`; ?> | |
3. Access whoami.php via the browswer to see who the user is that your web server runs as. | |
4. In the console, type this where {user} is the user from the whoami.php: | |
groups {user} | |
5. Observe the groups that the user belongs to. Usually it's just one. Usually it's "www-data" | |
6. cd to your WordPress directory | |
7. Run this command, change {user} to the user shown on the whoami.php page and {group} to the group from step 5 that looks like your server's group: | |
chown -R {user}:{group} wp-content |
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
alias.st=status | |
alias.ci=commit | |
alias.br=branch | |
alias.co=checkout | |
alias.df=diff | |
alias.dc=diff --cached | |
alias.lol=log --graph --decorate --pretty=oneline --abbrev-commit | |
alias.lola=log --graph --decorate --pretty=oneline --abbrev-commit --all | |
alias.ls=ls-files | |
alias.ign=ls-files -o -i --exclude-standard |
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
#menu{*zoom:1;zoom:1;border-bottom:1px solid #eaeaea;}#menu:before,#menu:after{content:"";display:table;} | |
#menu:after{clear:both;} | |
#menu:before,#menu:after{display:table;content:"";zoom:1;} | |
#menu:after{clear:both;} | |
#menu ol{list-style:none;margin-left:0;padding-left:0;} | |
#menu ol li{display:inline;float:left;line-height:24px;} | |
#menu ol li:hover{background:#582E91;} | |
#menu ol li:active>div>a{background-color:#582E91;font-weight:bold;} | |
#menu ol li ol{position:absolute;background:#582E91;z-index: 30;} | |
#menu ol li ol div{margin-top:10px;} |
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 | |
namespace Habari; | |
if ( !defined( 'HABARI_PATH' ) ) { die( 'No direct access' ); } | |
Config::set( 'db_connection', array( | |
'connection_string'=>'sqlite:habari.db', | |
'username'=>'', | |
'password'=>'', | |
'prefix'=>'' | |
)); |
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
SELECT | |
DISTINCT | |
{posts}.id AS id, | |
{posts}.slug AS slug, | |
{posts}.title AS title, | |
{posts}.guid AS guid, | |
{posts}.content AS content, | |
{posts}.cached_content AS cached_content, | |
{posts}.input_formats AS input_formats, | |
{posts}.user_id AS user_id, |
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
PREFIX dbo: <http://dbpedia.org/ontology/> | |
SELECT ?name ?birth ?death ?person ?wikipedia ?occupation WHERE { | |
?person dbo:birthDate ?birth . | |
?person foaf:name ?name . | |
?person a dbo:Actor . | |
OPTIONAL {?person dbo:deathDate ?death .} | |
OPTIONAL {?person dbpprop:dateOfDeath ?death2 .} | |
FILTER (?birth < "1950-01-01"^^xsd:date) | |
FILTER (?birth > "1890-01-01"^^xsd:date) |
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
if($userSchools[0]){ | |
$school_ids = array(); | |
foreach($userSchools as $school) { | |
$school_ids[$school['school_id']] = $school['school_id']; | |
} | |
$school_ids = array_filter($school_ids); | |
if(count($school_ids) > 0) { | |
$schools = "school_id IN ("; | |
$schools .= implode(',', $school_ids); |
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
// Run this on http://elections.nytimes.com/2012/results/president/big-board | |
$('.bucket tbody').each(function(){ | |
var bucket = $(this); | |
var sum = 0, dem = 0, rep = 0, ct = 0, report = 0; | |
bucket.find('tr').each(function(){ | |
if($(this).find('.ev-cell').length > 0) { | |
ct++; | |
var ev = parseInt($(this).find('.ev-cell').text()); | |
dempct = parseInt($(this).find('.nytint-pct-dem').text()); | |
reppct = parseInt($(this).find('.nytint-pct-rep').text()); |
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
/** | |
* Only accept even arguments in the URL | |
*/ | |
$app->route('even', new Regex('#^/number/(?P<number>[0-9]+)/?$#'), function(){ | |
echo "The number was even."; | |
})->validate(function($request) { return $request['number'] % 2 == 0;}); | |
/** | |
* Only accept odd arguments in the URL | |
*/ |
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 | |
function seive($candidates, $min = 0, $max = 0) { | |
$primes = array(); | |
$last = ($max == 0) ? floor(end($candidates) / 2) : $max; | |
$i = ($min == 0) ? reset($candidates) : $min; | |
while($i <= $last) { | |
$candidates = array_filter($candidates, function($n) use ($i, &$primes) { | |
if($n < $i) { |