Skip to content

Instantly share code, notes, and snippets.

View jmonterroso's full-sized avatar

Jayson Monterroso jmonterroso

View GitHub Profile
@jmonterroso
jmonterroso / rename_git.sh
Last active October 27, 2015 21:59 — forked from stuart11n/gist:9628955
rename git branch locally and remotely
git branch -m old_branch new_branch # Rename branch locally
git push origin :old_branch # Delete the old branch
git push --set-upstream origin new_branch # Push the new branch, set local branch to track the new remote
@jmonterroso
jmonterroso / git-author-format.md
Created November 25, 2015 16:31
git format author
git log --pretty=format:"%h%x09%an%x09%ad%x09%s" --author="Jayson"
stanceApp.directive('ccNumberValidator', function () {
/*
^(?:4[0-9]{12}(?:[0-9]{3})? # Visa
| 5[1-5][0-9]{14} # MasterCard
| 3[47][0-9]{13} # American Express
| 6(?:011|5[0-9]{2})[0-9]{12} # Discover
)$
*/
return {
require: 'ngModel',
@jmonterroso
jmonterroso / SycAtom.md
Created February 8, 2016 17:00
Sync Atom Packages

Sync Atom across different computers

Star your favorite packages or installed packages


apm star --installed 

@jmonterroso
jmonterroso / templates.md
Last active February 24, 2016 18:33
live templates intellij

Copy the code for live templates in the following path, saving as xml file:

/Users/jaysonmonterroso/Library/Preferences/IntelliJIdea15/templates

<templateSet group="JavaScript">
  <template name="forin" value="for (var $VAR$ in $ARRAY$) {&#10;  $END$&#10;}" description="Iterate (for..in)" toReformat="true" toShortenFQNames="true">
    <variable name="ARRAY" expression="jsArrayVariable()" defaultValue="&quot;array &quot;" alwaysStopAt="true" />
    <variable name="VAR" expression="jsSuggestVariableName()" defaultValue="&quot;o&quot;" alwaysStopAt="true" />
    <context>
@jmonterroso
jmonterroso / LICENSE
Created June 7, 2016 18:26 — forked from ourmaninamsterdam/LICENSE
Arrayzing - The JavaScript array cheatsheet
The MIT License (MIT)
Copyright (c) 2015 Justin Perry
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:
@jmonterroso
jmonterroso / add_admin_wp_user.sql
Last active May 5, 2017 05:43
Add admin user to wordpres using a mysql wordpress query
INSERT INTO `wp_users` (`user_login`, `user_pass`, `user_nicename`, `user_email`, `user_status`)
VALUES ('newadmin', MD5('admin'), 'firstname lastname', '[email protected]', '0');
INSERT INTO `wp_usermeta` (`umeta_id`, `user_id`, `meta_key`, `meta_value`)
VALUES (NULL, (Select max(id) FROM wp_users), 'wp_capabilities', 'a:1:{s:13:"administrator";s:1:"1";}');
INSERT INTO `wp_usermeta` (`umeta_id`, `user_id`, `meta_key`, `meta_value`)
VALUES (NULL, (Select max(id) FROM wp_users), 'wp_user_level', '10');
// Highcharts CheatSheet Part 1.
// Create interactive charts easily for your web projects.
// Download: http://www.highcharts.com/download
// More: http://api.highcharts.com/highcharts
// 1. Installation.
// Highcharts requires two files to run, highcharts.js and either jQuery, MooTools or Prototype or the Highcharts Standalone Framework which are used for some common JavaScript tasks.
// <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js"></script>
// <script src="https://code.highcharts.com/highcharts.js"></script>
@jmonterroso
jmonterroso / Katas.md
Last active August 4, 2017 18:14
Katas Solve

All Katas solved and snippets

Format number to currency

ES 6

let formatMoney = (amount) => `$${amount.toFixed(2)}`

Take a Ten Minute Walk

You live in the city of Cartesia where all roads are laid out in a perfect grid. You arrived ten minutes too early to an appointment, so you decided to take the opportunity to go for a short walk. The city provides its citizens with a Walk Generating App on their phones -- everytime you press the button it sends you an array of one-letter strings representing directions to walk (eg. ['n', 's', 'w', 'e']). You know it takes you one minute to traverse one city block, so create a function that will return true if the walk the app gives you will take you exactly ten minutes (you don't want to be early or late!) and will, of course, return you to your starting point. Return false otherwise.