Skip to content

Instantly share code, notes, and snippets.

View wendelnascimento's full-sized avatar
🎯
Focusing

Wendel Nascimento wendelnascimento

🎯
Focusing
View GitHub Profile
@wendelnascimento
wendelnascimento / .zshrc
Created August 21, 2017 14:07
Random cow in cowsay in .zshrc
dir='/usr/local/Cellar/cowsay/3.04/share/cows/'
file=`/bin/ls -1 "$dir" | gsort --random-sort | head -1`
cow=$(echo "$file" | sed -e "s/\.cow//")
fortune | cowsay -f $cow
@wendelnascimento
wendelnascimento / .zshrc
Last active April 5, 2022 13:34
My .zshrc
# If you come from bash you might have to change your $PATH.
# export PATH=$HOME/bin:/usr/local/bin:$PATH
# Path to your oh-my-zsh installation.
export ZSH="$HOME/.oh-my-zsh"
# Set name of the theme to load. Optionally, if you set this to "random"
# it'll load a random theme each time that oh-my-zsh is loaded.
# See https://github.com/robbyrussell/oh-my-zsh/wiki/Themes
ZSH_THEME="norm"
@wendelnascimento
wendelnascimento / roles.js
Last active January 10, 2018 21:52
Shawee roles fetch
var hackathonId = null;
fetch('https://api.shawee.io/api/graphql', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({
query:
'query hackathonRoles($link: String!) {\n hackathon(link: $link) {\n id\n roles {\n id\n name\n __typename\n }\n __typename\n }\n}\n',
variables: { link: 'shawee-test' },
@wendelnascimento
wendelnascimento / modal.html
Created January 10, 2018 21:48
Shawee example subscription modal
<div class="modal-container">
<div class="modal-skin"></div>
<div class="modal modal-signup">
<div class="modal-header">
<h1 class="modal-header-title">
Inscreva-se
</h1>
<div class="btn-close">
</div>
</div>
@wendelnascimento
wendelnascimento / subscribe.js
Last active December 17, 2018 19:49
Shawee subscription script
// First we get the form instance and add an listener for the submit event
var form = document.querySelector('.form');
form.addEventListener('submit', function(e) {
e.preventDefault();
var serialized = $('#submitForm').serializeArray();
var btnSend = document.querySelector('.btn-send');
btnSend.setAttribute('disabled', '');
btnSend.setAttribute('style', 'cursor: not-allowed');
// then we build the POST request to shawee API with all the variables to fill in the participant profile
@wendelnascimento
wendelnascimento / manyIfs.js
Created April 25, 2018 16:25
If chain to check object property
const { person } = this.state;
if (person) {
if (person.infos) {
if (person.infos.location) {
return (
<span>{person.infos.location}</span>
);
}
}
@wendelnascimento
wendelnascimento / withIdx.js
Created April 25, 2018 16:33
Example of using idx in place of chained ifs
const location = idx(this.state, _ => _.person.infos.location);
return (
<span>{location}</span>
);
@wendelnascimento
wendelnascimento / subscribeAjax.js
Created July 17, 2018 21:55
Subscribe to a shawee hackathon using jquery ajax
var form = document.querySelector('.form');
form.addEventListener('submit', function(e) {
e.preventDefault();
var serialized = $('#submitForm').serializeArray();
var btnSend = document.querySelector('.btn-send');
btnSend.setAttribute('disabled', '');
btnSend.setAttribute('style', 'cursor: not-allowed');
jQuery.ajax({
url: 'https://api.shawee.io/api/graphql',
type: 'POST',
@wendelnascimento
wendelnascimento / modal.css
Created April 2, 2019 22:49
Default modal css
/* modal */
.modal-container {
position: fixed;
left: 0;
right: 0;
bottom: 0;
top: 0;
display: flex;
background: rgba(0, 0, 0, 0.3);
align-items: center;
@wendelnascimento
wendelnascimento / modal.js
Created April 2, 2019 22:52
Modal js script
var modal = document.querySelector('.modal-container');
var btnOpen = document.querySelectorAll('.btn-open');
var btnClose = document.querySelector('.btn-close');
var modalSkin = document.querySelector('.modal-skin');
for (var i = 0; i < btnOpen.length; i++) {
btnOpen[i].addEventListener('click', function() {
modalToggle();
});
}