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 git@github.com: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
})
@jgraffin
jgraffin / 0_reuse_code.js
Created January 4, 2016 16:38
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@jgraffin
jgraffin / identify-browser-and-os.php
Last active August 31, 2015 20:56 — forked from celsofabri/identify-browser-and-os.php
Identify browser and os / Identifica navegador e sistema operacional
<?php
function mv_browser_body_class($classes) {
global $is_lynx, $is_gecko, $is_IE, $is_opera, $is_NS4, $is_safari, $is_chrome, $is_iphone;
if($is_lynx) $classes[] = 'lynx';
elseif($is_gecko) $classes[] = 'gecko';
elseif($is_opera) $classes[] = 'opera';
elseif($is_NS4) $classes[] = 'ns4';
elseif($is_safari) $classes[] = 'safari';
elseif($is_chrome) $classes[] = 'chrome';