Skip to content

Instantly share code, notes, and snippets.

Jonathan Cunanan jcunanan05

Block or report user

Report or block jcunanan05

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@jcunanan05
jcunanan05 / ghostcms.gitignore
Created Aug 25, 2019
Gitignore for GhostCMS
View ghostcms.gitignore
# Node template
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
# Runtime data
@jcunanan05
jcunanan05 / reactIntlSample.js
Created Aug 23, 2019
react-intl sample code using messages for locale
View reactIntlSample.js
import React, { useState } from "react";
import { IntlProvider, FormattedMessage } from "react-intl";
const messages = {
en: {
"app.hello": "Hello"
},
fr: {
"app.hello": "Bonjour"
}
@jcunanan05
jcunanan05 / rails_commands.sh
Created Aug 5, 2019
Rails commands that i forget / commonly use
View rails_commands.sh
# run rails on a docker container / virtual container
rails server -p $PORT -b 0.0.0.0
# bundle
bundle update
bundle install
View multiple_ssh_git.sh
# enable git push ssh on multiple repos
# delete cached
ssh-add -D
#1. go to your ~/.ssh
#2. open your favorite local editor
@jcunanan05
jcunanan05 / renderPropSample.js
Created Jun 22, 2019
react example for render prop
View renderPropSample.js
/**
*
* @param {*} menuEnd - navbar right side.
* @param {*} renderDrawer({ isOpen, closeDrawer }) - render prop drawer component
* @param {object} classes - styles injected
*/
class Navbar extends Component {
state = {
isDrawerOpen: false,
View mac_commands.sh
# enable installation
sudo spctl --master-disable
View jumpClouds.js
// Complete the jumpingOnClouds function below.
function jumpingOnClouds(cloudList) {
const SAFE = 0;
const DANGER = 1;
let stepCount = 0;
// loop through the array
for (
let i = 0,
totalSteps = cloudList.length -1;
i < totalSteps;
View mdnAsyncVsAsyncAwait.js
// Display detail page for a specific Author.
exports.author_detail = async function(req, res) {
// async.parallel(
// {
// author: function(callback) {
// Author.findById(req.params.id).exec(callback);
// },
// author_books: function(callback) {
// Book.find({ author: req.params.id }, "title summary").exec(callback);
// }
@jcunanan05
jcunanan05 / stairSteps.js
Created May 24, 2019
stair case problem on how many steps it can take
View stairSteps.js
function staircase(stairSteps) {
function fibonnaci(n) {
if(n <= 1) return 1;
else {
return fibonnaci(n - 1) + fibonnaci(n - 2);
}
}
return fibonnaci(stairSteps);
}
View cardComparison.js
/**
* war.js
* Algorithm complexity might be O(n + 4). 4 Lookups + 1 Loop
*/
const CARD_ORDER = 'AKQJT98765432';
function war(handA, handB) {
let totalScore = 0;
You can’t perform that action at this time.