Skip to content

Instantly share code, notes, and snippets.

View AyoAlfonso's full-sized avatar
:octocat:
Building

Ayo Alfonso AyoAlfonso

:octocat:
Building
View GitHub Profile
@AyoAlfonso
AyoAlfonso / home-brew-mysql-essential-commands
Created February 14, 2019 12:57 — forked from jasperf/home-brew-mysql-essential-commands
Homebrew Create a MySQL database and user to be used for a WordPress site from the command line with mysql and restart server when you have a socket error or other error #wordpress #mysql #homebrew
//homebrew mysql start
/usr/local/Cellar/mysql/5.6.19/bin/mysql.server restart
//or
mysql.server start
//check for access privileges
mysqlaccess localhost user database
importScripts('https://www.gstatic.com/firebasejs/4.8.1/firebase-app.js');
importScripts('https://www.gstatic.com/firebasejs/4.8.1/firebase-messaging.js');
import messaging from 'config/firebase'
messaging.setBackgroundMessageHandler(function (payload) {
console.log('We Received a background message ', payload);
const notificationTitle = 'New Background Message Title';
const notificationOptions = {
import messaging from 'config/firebase'
export function initializePush() {
messaging
.requestPermission()
.then(() => {
return messaging.getToken();
})
.then(token => {
console.log("FCM Token:", token);
@AyoAlfonso
AyoAlfonso / indexOfCRA.js
Last active December 5, 2018 23:04
Entry point of our Firebase react app
/**
* @description Entry point of our app
*/
const Component = () => (
<Provider store={store}>
<App />
</Provider>
)
@AyoAlfonso
AyoAlfonso / removeElement.js
Created November 25, 2018 18:04
Remove Elements Without Filtering
export const removeElement = (list, id) => {
const removeIndex = list.findIndex(item => item.id === id)
if (removeIndex == -1) {
return list;
/*Return the original array if you cant find the id to delete*/
}
if (removeIndex == 0){
return ...list.slice(1);
}
@AyoAlfonso
AyoAlfonso / gist:e5f39d60a83d5adc4a897919818a9560
Created November 15, 2018 09:38 — forked from digitaljhelms/gist:4287848
Git/GitHub branching standards & conventions

Branching

Quick Legend

Description, Instructions, Notes
Instance Branch
@AyoAlfonso
AyoAlfonso / sample.js
Created November 12, 2018 09:33 — forked from chowryan/sample.js
react setstate?
// Method 1:
class Parent extends Component {
state = { foo: '', bar: '', buzz: '' }
render() {
return (
<Child
setParentState={this.setState}
>
)
@AyoAlfonso
AyoAlfonso / firebaseComments.js
Created October 2, 2018 22:44
A Function For Unfolding Comments on Firebase
let rootCommentsCard = []
let repliesCard = []
function arrangeComments(comments){
for (var commentId in comments) {
let parent = comments[commentId].parent
if (parent[0] == 'root') {
comments[commentId].commentId = commentId
comments[commentId].replies = []
rootCommentsCard.push(comments[commentId])
let array = [{
name: "John",
ranking: 5
}, {
name: "Sam",
ranking: 4
}, {
name: "Timi",
ranking: 1
}, {
function test(){
var h = 'Hello';
var w = 'World';
return w,
console.log(f),
h;
}
console.log(this.test()); //World