Skip to content

Instantly share code, notes, and snippets.

View deletosh's full-sized avatar

Dele Tosh deletosh

View GitHub Profile
@deletosh
deletosh / email_parse_url.py
Created March 2, 2019 23:23 — forked from aptgetupgrade/email_parse_url.py
code to poll emails from an IMAP email server and post these to wallabag
# Read email in inbox, look for any URLs and update them to wallabag, delete email if URLs found in it.
# Built from various internet sources. Final code donated under GPL v3 by Github user aptgetupgrade
# Tested using python 2. Could be run as part of a crontab, e.g. every 5 mins.
#
import sys
import imaplib
import getpass
import email
import email.header
import datetime
@deletosh
deletosh / README.md
Last active March 8, 2018 17:25 — forked from Alymosul/README.md
Downgrade PHP 7.1 to 7.0 on Laravel Forge

Install php7.0 related stuff..

apt-get install -y --allow-downgrades --allow-remove-essential --allow-change-held-packages \
php7.0-cli php7.0-dev \
php7.0-pgsql php7.0-sqlite3 php7.0-gd \
php7.0-curl php7.0-memcached \
php7.0-imap php7.0-mysql php7.0-mbstring \
php7.0-xml php7.0-zip php7.0-bcmath php7.0-soap \
php7.0-intl php7.0-readline php-xdebug php-pear php7.0-fpm
#!/bin/bash
set -e
THIS_SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
cd "${THIS_SCRIPT_DIR}/.."
# Check if there's something uncommitted (don't release if there are files
# not yet committed)
set +e
@deletosh
deletosh / cap.rb
Last active August 29, 2015 14:14 — forked from kix/cap.rb
http://www.dizzy.co.uk/cheatsheets
This work is licensed under the Creative Commons
Attribution-NonCommercial-NoDerivs 2.0 License. To
view a copy of this license, visit
http://creativecommons.org/licenses/by-nc-nd/2.0/uk
########## Shell Commands ##########
Installation:
$ gem install capistrano
# From a fresh install of squeeze
apt-get install ruby rubygems # Need ruby to use fpm
gem1.8 install fpm --no-ri --no-rdoc
apt-get install build-essential openssl libreadline6 libreadline6-dev zlib1g zlib1g-dev libssl-dev ncurses-dev libyaml-dev
wget ftp://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.3-p125.tar.gz
tar -zxvf ruby-1.9.3-p125.tar.gz
cd ruby-1.9.3-p125
rm -rf /tmp/ruby193

How to use MAMP with the mysql2 gem and Ruby 1.9.3-p194 via rbenv

Let's say you're a web developer who happens to work with both MAMP and Ruby when building different types of websites. Let's say you also like to keep your MySQL stuff in one place and don't like having to juggle both a local MySQL install as well as a MAMP MySQL install. Well, you can indeed connect your ruby apps to MAMP's MySQL. Here's a tutorial on how to do it.

Important! Before you do anything, download and install MAMP. MAMP Pro will work as well. At the time of this writing, MAMP 2.1.1 is the latest.

First, install Ruby via rbenv

  1. Install homebrew
  2. Install rbenv: brew install rbenv, follow any instructions homebrew gives you after the installation is complete.
# Initial setup
git clone -o framework -b develop https://github.com/laravel/laravel.git project-name
cd project-name
git checkout --orphan master
git add .
git commit -m "Initial commit"
# Pulling changes
git fetch framework
git merge --squash -m "Upgrade Laravel" framework/develop
<?php
require_once 'ControllerTestCase.php';
class AccountControllerTest extends ControllerTestCase
{
public function testSignupWithNoDataRedirectsAndHasErrors()
{
$response = $this->post('account@signup', array());
@deletosh
deletosh / ide_helper.php
Created June 21, 2012 01:36
Laravel3 IDE Helper
<?php
class Auth extends Laravel\Auth {}
/**
* @method static add(string $name, string $source, array $dependencies = array(), array $attributes = array())
* @method static string styles()
* @method static string scripts()
*/
class Asset extends Laravel\Asset {}
class Autoloader extends Laravel\Autoloader {}
class Bundle extends Laravel\Bundle {}
@deletosh
deletosh / gist:2499402
Created April 26, 2012 13:02 — forked from lucasfais/gist:1207002
Sublime Text 2 - Useful Shortcuts

Sublime Text 2 – Useful Shortcuts (Mac OS X)

General

⌘T go to file
⌘⌃P go to project
⌘R go to methods
⌃G go to line
⌘KB toggle side bar
⌘⇧P command prompt