Skip to content

Instantly share code, notes, and snippets.

View pmutua's full-sized avatar
🐲
Focus mode

Philip Mutua pmutua

🐲
Focus mode
View GitHub Profile
@jonico
jonico / .env
Last active June 1, 2023 09:04
How to run PlanetScale alongside with an MySQL enabled app that does not have any other internet access
PLANETSCALE_DB=brandnewdb
PLANETSCALE_BRANCH=mybranch
PLANETSCALE_ORG=jonico
PLANETSCALE_SERVICE_TOKEN=pscale_tkn_loCzIH7NktDK-GWJ71eX97Qr5D3a9iEO_pgHCSHUtw
PLANETSCALE_SERVICE_TOKEN_NAME=69xrlIwgs4ms
@Jonremus
Jonremus / startup_tools.md
Created August 20, 2019 18:09 — forked from cedrickchee/startup_tools.md
Curated directory of the best startup tools

Here are the best startup tools of 2019 that will help you build out your startup business as quickly, cheaply, and efficiently as possible.

This is a curated list of tools for everything from productivity to web hosting to development tools to designing. Most of these tools are either free or have limited free option that is enough for startups. We love all the free services out there, but it would be good to keep it on topic. It's a bit of a grey line at times so this is a bit opinionated; feel free to suggest and contribute in this list.

Source Code Repos

  • GitHub — Unlimited public repositories and unlimited private repositories (up to 3 collaborators).
  • GitLab — Unlimited public and private Git repos with unlimited collaborators.
  • BitBucket — Unlimited public and private repos (Git and Mercurial) for up to 5 users with Pipelines for CI/CD.
  • Visual Studio — Unlimited private repos (Git a
@rg3915
rg3915 / django_orm_optimization_cheat_sheet.py
Last active August 26, 2023 15:51 — forked from levidyrek/django_orm_optimization_cheat_sheet.py
Django ORM optimization cheat sheet
"""
Django ORM Optimization Tips
Caveats:
* Only use optimizations that obfuscate the code if you need to.
* Not all of these tips are hard and fast rules.
* Use your judgement to determine what improvements are appropriate for your code.
"""
# ---------------------------------------------------------------------------

In your models.py put:

from django.db import models

@classmethod
def model_field_exists(cls, field):
    try:
        cls._meta.get_field(field)
 return True
@bmaupin
bmaupin / free-database-hosting.md
Last active May 7, 2024 20:03
Free database hosting
@oidualc
oidualc / fix-cordova-6.4.0-semver.patch
Last active December 11, 2020 23:59
Fix for semver error in cordova 6.4.0
--- a/platforms/android/cordova/lib/emulator.js 2018-08-08 12:34:38.000000000 +0200
+++ b/platforms/android/cordova/lib/emulator.js 2018-08-08 14:14:35.000000000 +0200
@@ -187,7 +187,7 @@
var api_level = avd.target.match(/\d+/);
if (api_level) {
var level = android_versions.get(api_level);
- avd.target = 'Android ' + level.semver + ' (API level ' + api_level + ')';
+ avd.target = 'Android ' + (level ? level.semver : '') + ' (API level ' + api_level + ')';
}
}
@pmutua
pmutua / test_image_upload.py
Created June 26, 2018 08:57 — forked from guillaumepiot/test_image_upload.py
Django Rest Framework - Image/File upload test
import os
import io
from PIL import Image
from django.core.urlresolvers import reverse
from django.conf import settings
from rest_framework import status
from rest_framework.test import APITestCase
@harrietty
harrietty / RAILS_5_CHEATSHEET.md
Last active August 13, 2023 00:36 — forked from mdang/RAILS_CHEATSHEET.md
Ruby on Rails 5 Cheatsheet

Ruby on Rails Cheatsheet (5.1)

Architecture

RVM

$ rvm list - show currently installed Rubies

@linxuedong
linxuedong / test_auto_now_DateTime_Fields.md
Last active June 30, 2023 22:35
Django test auto_now DateTime Fields
class Article(models.Model):    
    title = models.CharField()
    content = models.TextField()
    created = models.DateTimeField(auto_now_add=True)
    modified = models.DateTimeField(auto_now=True)

I want to an article which was created and modified yesterday. And test the things today.

@pmutua
pmutua / multi-git.md
Created November 29, 2017 12:52 — forked from rosswd/multi-git-win.md
Setting up a Github and Bitbucket account on the same computer.

Setting up github and bitbucket on the same computer

Github will be the main account and bitbucket the secondary.

Create SSH Keys

ssh-keygen -t rsa -C "github email"

Enter passphrase when prompted. If you see an option to save the passphrase in your keychain, do it for an easier life.