Skip to content

Instantly share code, notes, and snippets.

View samueleastdev's full-sized avatar

Samuel East samueleastdev

View GitHub Profile
@samueleastdev
samueleastdev / index.php
Last active January 8, 2018 22:50
PHP Get mime type from extension string PLEASE ADD
<?php
/**
* Finds mime types based on extension string
*
* @return mime type / application/octet-stream
* @author @sameast
*/
function getMimeTypeFromExtensionString($key){
@samueleastdev
samueleastdev / enablePush.js
Last active November 28, 2017 23:57
Appcelerator push notifications IOS & Android
/*
* Setup push notification for Appc
* callback
*/
// Android go to firebase https://console.firebase.google.com
// Create project
// Add android app
// Enter SHA1 key run: keytool -exportcert -keystore keystore -list -v
// Click project cog -> project settings and then cloud messaging
@samueleastdev
samueleastdev / shell.sh
Last active November 7, 2017 15:00
Mongo Database Helper Commands
# Shutdown already running database instances
ps ax | grep mongod
kill -9 0000
# show databases
show dbs
# Switch current database to
use <db>
@samueleastdev
samueleastdev / index.js
Created October 24, 2017 21:05
Video js menu button list
/**
* Author (c) Hany alsamman
* Licensed under the Apache-2.0 license.
**/
(function () {
/* jshint eqnull: true*/
/* global require */
'use strict';
var videojs = null;
@samueleastdev
samueleastdev / umd-script-boilerplate.js
Created March 11, 2017 04:19 — forked from cferdinandi/umd-script-boilerplate.js
A simple boilerplate for UMD JS modules.
(function (root, factory) {
if ( typeof define === 'function' && define.amd ) {
define([], factory(root));
} else if ( typeof exports === 'object' ) {
module.exports = factory(root);
} else {
root.myPlugin = factory(root);
}
})(typeof global !== "undefined" ? global : this.window || this.global, function (root) {
@samueleastdev
samueleastdev / index.php
Last active February 17, 2017 16:55
WordPress Insert or Update statement
function update_globals(){
if (!is_user_logged_in()) exit();
global $wpdb;
$doesExist = $wpdb->get_row( "SELECT * FROM table WHERE id = " . get_current_user_id() );
// Update array
$upValues = isset($_REQUEST) ? $_REQUEST : false;
@samueleastdev
samueleastdev / index.sh
Created January 24, 2017 14:08
Setting Up Multiple Github Accounts
ssh-keygen -t rsa -C "your-email-address"
Be careful that you don't over-write your existing key for your personal account. Instead, when prompted, save the file as id_rsa_COMPANY. In my case, I've saved the file to ~/.ssh/id_rsa_s3bubble.
vim ~/.ssh/id_rsa_COMPANY.pub
touch ~/.ssh/config
vim config
#Default GitHub
@samueleastdev
samueleastdev / shell.sh
Created January 20, 2017 17:59
Publishing to the npm repo
npm adduser
npm publish
@samueleastdev
samueleastdev / index.js
Last active March 25, 2019 11:09
CRUD Lambda RDS Template
'use strict';
var mysql = require('mysql');
exports.handler = (event, context, callback) => {
var connection = mysql.createConnection({
host : 'rds.amazonaws.com',
database : 'database',
user : 'user',