Skip to content

Instantly share code, notes, and snippets.

View ferndot's full-sized avatar

Fern (they/them) ferndot

  • Seattle, WA, USA
  • 15:00 (UTC -07:00)
View GitHub Profile
function allMaze(x, y, maze) {
let validPaths = []
if (y < 0 || x < 0 || y > maze.length - 1 || x > maze[y].length - 1) {
return false
} else if (maze[y][x] === "e") {
return ['']
} else if (maze[y][x] == "*") {
return false
}
➜ Desktop python test.py
['H', ' ', ' ', '*', ' ', ' ', ' ']
['*', '*', ' ', '*', ' ', '*', ' ']
[' ', ' ', ' ', ' ', ' ', ' ', ' ']
[' ', '*', '*', '*', '*', '*', ' ']
[' ', ' ', ' ', ' ', ' ', ' ', 'e']
['*', 'H', ' ', '*', ' ', ' ', ' ']
@ferndot
ferndot / emails.py
Created October 31, 2018 14:26
django-simple-email-confirmation-drf
from django.conf import settings
from templated_mail.mail import BaseEmailMessage
class VerificationEmail(BaseEmailMessage):
template_name = 'email/email_verification.html'
def get_context_data(self):
# Get context and user
@ferndot
ferndot / filters.json
Last active September 21, 2018 18:00 — forked from guyjacks/filters.json
{
"rule-restraints": {
"stength": {
"min": null,
"max": null
}
},
"match-restraints": {
"min-rules-matched": null,
"max-rules-matched": null
@ferndot
ferndot / App.js
Created July 19, 2018 15:49
React Navigation
import React from 'react';
import {
StyleSheet,
View,
StatusBar
} from 'react-native';
import { Provider } from 'react-redux';
import RootNavigator from './src/navigation/RootNavigator';
import store from './src/store';
@ferndot
ferndot / my_account.php
Created May 3, 2018 16:28
WooCommerce My Account Custom Tabs
<?php
/*
Add My Account endpoints
*/
function custom_endpoints() {
add_rewrite_endpoint('page1', EP_ROOT | EP_PAGES);
add_rewrite_endpoint('page2', EP_ROOT | EP_PAGES);
}
import requests
def _url(path):
return 'https://api.pandapay.io/v1' + path
def _auth(pandapay_secret):
return (pandapay_secret)
class Goal(object):
name = 'Generic Goal'
@classmethod
def getConcreteClasses(cls):
for c in cls.__subclasses__():
yield c
for c2 in c.getConcreteClasses():
yield c2
@ferndot
ferndot / lamp_debian_9.sh
Last active November 13, 2017 00:12
Configures LAMP and other useful things on a fresh Debian 9 install
# Update Debian and installed packages
apt-get update
apt-get -y upgrade
apt-get -y dist-upgrade
# Install curl, etckeeper, and LAMP
apt-get install -y curl etckeeper apache2 mariadb-server mariadb-client mariadb-common php php-dev php-mysqli python-certbot-apache sendmail
# Configure apache2
a2enmod rewrite headers
@ferndot
ferndot / create_site.sh
Last active July 23, 2017 16:46
Creates a website on apache.
cd /var/www/
sudo mkdir -p /var/www/$1/public_html
sudo ./perms.sh $1
echo "Success!" >> /var/www/$1/public_html/index.html
vHostFile=/etc/apache2/sites-available/$1.conf
sudo echo "<VirtualHost *:80>" >> $vHostFile
sudo echo -e "\tServerName $1" >> $vHostFile
sudo echo -e "\tServerAlias www.$1" >> $vHostFile