Skip to content

Instantly share code, notes, and snippets.

View celsofabri's full-sized avatar
👾
The truth is dubious

Celso Fabri Junior celsofabri

👾
The truth is dubious
View GitHub Profile
@celsofabri
celsofabri / loadFeed.js
Last active August 26, 2016 18:32
LoadFeed Instagram/Recruiterbox
var instagramUrl = 'https://api.instagram.com/v1/users/self/media/recent/?access_token=myToken&callback=?&limit=1&count=12';
var recruiterboxUrl = 'https://jsapi.recruiterbox.com/v1/openings?client_name=myAccountName&limit=5';
// Instagram Media Load
var loadFeed = function(url, callback) {
$.ajax({
url: url,
dataType: 'json',
success: function(response) {
@celsofabri
celsofabri / no-comments.js
Created April 4, 2017 18:56
Remove all comments from GitHub Pull Request
// Sometimes it's necessary to do a bit of clean-up
Array.prototype.forEach.call(document.querySelectorAll('.js-comment-delete button'), function(el, i) {
el.removeAttribute('data-confirm');
el.click();
});
@celsofabri
celsofabri / WP Title Limit
Last active July 24, 2020 20:09
Word title limit WordPRess
function limit_word_count($title) {
$len = 5; //change this to the number of words
if (str_word_count($title) > $len) {
$keys = array_keys(str_word_count($title, 2));
$title = substr($title, 0, $keys[$len]);
}
return $title;
}
add_filter('the_title', 'limit_word_count');
@celsofabri
celsofabri / context.js
Created September 16, 2020 13:19
Creating a context layer in React App
import React, { createContext, useState } from 'react';
import initialValues from './initial';
const Context = createContext(initialValues);
const GlobalContext = ({ children }) => {
const [globalState, setGlobalState] = useState(initialValues);
return (
<Context.Provider value={{ globalState, setGlobalState }}>
@celsofabri
celsofabri / prettier-preferences
Created September 23, 2020 20:46
Preferences Prettier Sublime
{
"auto_format_on_save": true,
"auto_format_on_save_excludes": [
"/node_modules/",
"*.json",
"*.md",
"*.html"
],
"prettier_options": {
@celsofabri
celsofabri / chrome-no-cors
Created December 21, 2021 12:53
Open chrome without CORS
open -n -a /Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome --args --user-data-dir="/tmp/chrome_dev_test" --disable-web-security