Skip to content

Instantly share code, notes, and snippets.

@kharysharpe
kharysharpe / readme.md
Created March 14, 2017 16:36 — forked from xeoncross/readme.md
140 byte PHP routing framework (well, it's just a function actually)

140 byte PHP routing system.

This is a very simply routing system that makes it easy to test requests to different paths. This is very limited so do not use for your applications - it's just for fun.

require('route.php');

// A user profile
route('/(\w+)/profile', function($path, $user)
{

print "Hello " . $user;

<?php
// Source: http://www.web-max.ca/PHP/email_1.php
$username = '';
$password = '';
$server = 'pop3.example.com'
$port = 110;
$cmd = array();
$cmd[] = "USER $username\r\n";
@kharysharpe
kharysharpe / JSON API Response.md
Last active May 19, 2017 14:31
JSON API Response

Schema:


{
	success: true|false
	container: {}|[],
	meta: {
		page: [int],
		perPage: [int],
@kharysharpe
kharysharpe / android-emulator-homebrew.sh
Created March 30, 2018 22:13
Android Emulator with Homebrew
touch ~/.android/repositories.cfg
brew cask install caskroom/versions/java8
brew cask install android-sdk
brew cask install intel-haxm
brew install qt
export ANDROID_SDK_ROOT="/usr/local/share/android-sdk"
sdkmanager "platform-tools" "platforms;android-27" "extras;intel;Hardware_Accelerated_Execution_Manager" "build-tools;27.0.0" "system-images;android-27;google_apis;x86" "emulator"
avdmanager create avd -n test -k "system-images;android-27;google_apis;x86"
/usr/local/share/android-sdk/tools/emulator -avd test
@kharysharpe
kharysharpe / postgres-cheatsheet.md
Created April 15, 2018 18:32 — forked from Kartones/postgres-cheatsheet.md
PostgreSQL command line cheatsheet

PSQL

Magic words:

psql -U postgres

Some interesting flags (to see all, use -h):

  • -E: will describe the underlaying queries of the \ commands (cool for learning!)
  • -l: psql will list all databases and then exit (useful if the user you connect with doesn't has a default database, like at AWS RDS)
Failed building wheel for PyYAML
Running setup.py clean for PyYAML
Running setup.py bdist_wheel for SQLAlchemy: started
Running setup.py bdist_wheel for SQLAlchemy: finished with status 'done'
Stored in directory: /root/.cache/pip/wheels/89/38/e1/e121d77c19eeeee42baabc2e623f08285267daedbf2fea9dd7
Running setup.py bdist_wheel for SQLAlchemy-Utils: started
Running setup.py bdist_wheel for SQLAlchemy-Utils: finished with status 'done'
Stored in directory: /root/.cache/pip/wheels/eb/2b/fa/a7b34d1ebfc759948b471948616b8bb159d62ea0447cc2933c
Running setup.py bdist_wheel for wrapt: started
Running setup.py bdist_wheel for wrapt: finished with status 'done'

Rails naming conventions

General Ruby conventions

Class names are CamelCase.

Methods and variables are snake_case.

Methods with a ? suffix will return a boolean.

@kharysharpe
kharysharpe / v-cloak.md
Created January 2, 2019 00:43 — forked from adamwathan/v-cloak.md
Useful CSS utilities for Vue.js cloaking

Handy helpers for controlling visibility of elements until Vue has compiled.

Use like:

<div v-cloak>
  <h1>
    <span class="v-cloak--inline">Loading...</span> <!-- Only displayed before compiling -->
    <span class="v-cloak--hidden">{{ post.title }}</span> <!-- Hidden until compiling is finished -->
 
@kharysharpe
kharysharpe / GetCardSwipe.js
Created August 12, 2019 12:55 — forked from marothstein/GetCardSwipe.js
Basic implementation of methods needed to receive swiped credit card data with javascript.
/*
* Basic implementation of methods needed to receive swiped credit card data with javascript.
*
* NOTE: PCI compliance specifies that card data must never be stored in an unencrypted manner, and
* only certain pieces of card data can be stored persistently. Ensure that output logging is NOT
* stored persistently when using this file, as it contains console.log messages that are intended
* to educate the user, and these messages contain data that may compromise your PCI compliance posture.
*
* If you choose to use any of this code with real credit card data, it is your responsibility
* to remove all log statements, output, or other code that may serve to persist offending information.
# This is a sample build configuration for PHP.
# Check our guides at https://confluence.atlassian.com/x/e8YWN for more examples.
# Only use spaces to indent your .yml configuration.
# You can specify a custom docker image from Docker Hub as your build environment.
# run composer check-platform-reqs for a list of required extensions.
image: php:7.2-fpm
pipelines:
default:
# Not needed unless you're doing feature tests.
# - step: