Skip to content

Instantly share code, notes, and snippets.

View jgraffin's full-sized avatar

Julio Graffin jgraffin

View GitHub Profile
@jgraffin
jgraffin / Setting_upa_new_repo.md
Created June 5, 2023 21:04 — forked from alexpchin/Setting_upa_new_repo.md
Create a new repository on the command line

Setting up a new Git Repo

##Create a new repository on the command line

touch README.md
git init
git add README.md
git commit -m "first commit"

git remote add origin [email protected]:alexpchin/.git

@jgraffin
jgraffin / fix_authenticity_of_github_problem.md
Created October 31, 2022 12:49 — forked from vikpe/fix_authenticity_of_github_problem.md
FIX: The authenticity of host github.com can't be established.

Error

The authenticity of host 'github.com (140.82.113.4)' can't be established.

Fix

ssh-keyscan github.com >> ~/.ssh/known_hosts
@jgraffin
jgraffin / remove-dash-example.js
Created June 24, 2019 12:52 — forked from iruslani/remove-dash-example.js
JS Function to remove dashes. You can use it for other characters as well by changing the js regular expression.
<script type="text/javascript">
$(document).ready(function(){
$.cleanString = function(testString) {
var numericString = testString.replace(/-/gi," ");
// .replace() uses regular expression. In this case, its replaceing '-' with ' '.
return numericString;
}
var question = "Sample-text-with-some-dashes";
var cleaned = $.cleanString(question);
@jgraffin
jgraffin / remover-acentos.js
Created June 24, 2019 12:17 — forked from marioplumbarius/remover-acentos.js
Funcao marota para remover acentos de strings. Foi utilizado expressao regular em cima de caracteres representados na base hexadecimal.
/**
* Remove acentos de caracteres
* @param {String} stringComAcento [string que contem os acentos]
* @return {String} [string sem acentos]
*/
function removerAcentos( newStringComAcento ) {
var string = newStringComAcento;
var mapaAcentosHex = {
a : /[\xE0-\xE6]/g,
e : /[\xE8-\xEB]/g,
@jgraffin
jgraffin / ParentChild.es6
Created August 23, 2018 02:57 — forked from sebkouba/ParentChild.es6
Basic example to pass values between parent and child components in React.
/**
* Basic example to pass values between parent and child components in React
* Seems to be in line with this
* http://stackoverflow.com/questions/24147331/react-the-right-way-to-pass-form-element-state-to-sibling-parent-elements
* Now I have the state in parent and child. Is that good or bad? Why would I need it in child?
* Could probably take that out
* */
class Parent extends React.Component {
constructor(props) {
super(props);
@jgraffin
jgraffin / animatedScrollTo.js
Created April 11, 2018 02:28 — forked from joshbeckman/animatedScrollTo.js
ScrollTo animation using pure javascript and no jquery
document.getElementsByTagName('button')[0].onclick = function () {
scrollTo(document.body, 0, 1250);
}
function scrollTo(element, to, duration) {
var start = element.scrollTop,
change = to - start,
currentTime = 0,
increment = 20;
@jgraffin
jgraffin / README.md
Created October 30, 2016 16:58 — forked from joyrexus/README.md
Vanilla JS equivalents of jQuery methods

Sans jQuery

Events

// jQuery
$(document).ready(function() {
  // code
})
<?php
function footer_scripts() {
if(is_page('faca-sua-parte-dicas-de-como-votar-bem')) {
wp_enqueue_script( 'filter', get_stylesheet_directory_uri() . '/dist/assets/myDev/js/view/dicas.js', array(), null, true );
}
wp_localize_script( 'filter', 'wpAjax', array( 'ajaxurl'=>admin_url('admin-ajax.php') ) );
}
add_action( 'wp_enqueue_scripts', 'footer_scripts', 1 );
@jgraffin
jgraffin / Mobile menu
Last active May 21, 2016 02:51
Mobile menu with pure JS
document.addEventListener('DOMContentLoaded', mainReady);
var global = null;
function mainReady(){
var global = new Global();
global.init();
}
@jgraffin
jgraffin / gist:3e85c0072b3400989519
Created January 7, 2016 00:38
Música: Consideração
Acabei de chegar, não me vem mais nada, a caminho do bar, onde dá pra pensar?
Vivo entrelaçado, fiapos de pensamento me enibem até eu me acalmar.
REFRÃO
Pensei em um caminho do qual pudesse me lembrar, mas hoje está tão tarde que não, vou me entregar
ao abalo emocional de carga que insiste em continuar,
ao abalo emocional de carga que insiste em me assombrar...
SOLO DE GUITARRA DESTRUIDOR -------------------