Skip to content

Instantly share code, notes, and snippets.

@przor3n
przor3n / README.md
Created April 1, 2020 07:44 — forked from nikcub/README.md
Facebook PHP Source Code from August 2007
@przor3n
przor3n / Email Server (Linux, Unix, Mac).md
Last active January 15, 2020 16:59 — forked from raelgc/Email Server (Linux, Unix, Mac).md
Setup a Local Only SMTP Email Server (Linux, Unix, Mac)

Setup a Local Only SMTP Email Server (Linux, Unix, Mac)

1 - Point localhost.com to your machine

Most of programs will not accept an email using just @localhost as domain. So, edit /etc/hosts file to make the domain localhost.com point to your machine, including this content to the file:

127.0.0.1 localhost.com

2 - Install Postfix

@przor3n
przor3n / web-servers.md
Created August 16, 2019 18:02 — forked from willurd/web-servers.md
Big list of http static server one-liners

Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.

Discussion on reddit.

Python 2.x

$ python -m SimpleHTTPServer 8000
function testStatic($dupa){
static $i = 0;
static $last = 100;
echo $last;
return $dupa . " - " . $i++;
}
foreach (range(0,20) as $nn) {
echo testStatic($nn) . "\n";
function generate_random($string) {
$charactersLength = strlen($string);
$randomString = '';
for ($i = 0; $i < $charactersLength; $i++) {
$randomString .= $string[rand(0, $charactersLength - 1)];
}
return $randomString;
}
$node = \Drupal::routeMatch()->getParameter('node');
if ($node) {
// You can get nid and anything else you need from the node object.
$nid = $node->id();
}
@przor3n
przor3n / wordpress-snips.php
Created February 13, 2017 22:22
Wordpress snips
<?php
function removeShit()
{
global $wpdb;
$posts = $wpdb->get_results("
SELECT wp.ID, wp.post_content FROM wp_posts wp, novationstudio_events_event e WHERE wp.post_title = e.title;
");
foreach($posts as $post) {
git checkout develop
git pull
git checkout branch #co by zapisać
git fetch develop
git rebase upstream/develop develop #tutaj sobie cofamy
@przor3n
przor3n / gist:1bab6ff1235849da8693
Created March 23, 2016 15:41
Git reset local branch to remote
git fetch origin
git reset --hard origin/master
class InvalidRowException extends \Exception
{
public static function incorrectColumns(Row $row) {
return new static("Row #" . $row->getIndex() . " is missing one or more columns");
}
}
if (!$row->hasColumns($expectedColumns)) {
throw InvalidRowException::incorrectColumns($row);
}