Skip to content

Instantly share code, notes, and snippets.

View marcofugaro's full-sized avatar

Marco Fugaro marcofugaro

View GitHub Profile
@marcofugaro
marcofugaro / handlebars-if.js
Created November 16, 2015 19:31
If operator in Handlebars.js
Handlebars.registerHelper('ifCond', function (v1, operator, v2, options) {
switch (operator) {
case '==':
return (v1 == v2) ? options.fn(this) : options.inverse(this);
case '===':
return (v1 === v2) ? options.fn(this) : options.inverse(this);
case '!=':
return (v1 != v2) ? options.fn(this) : options.inverse(this);
case '!==':
@marcofugaro
marcofugaro / contact-form.js
Last active February 1, 2024 08:30
simple php mail snippet with PHPMailer through SMTP and Google reCAPTCHA
var form = $('#form');
form.find('[type="submit"]').on('click', function(e) {
var isFormValid = form[0].checkValidity();
var isCaptchaOk = $('#g-recaptcha-response').val();
if(isFormValid && isCaptchaOk) {
e.preventDefault();
var dataObj = {
@marcofugaro
marcofugaro / index.html
Created January 13, 2016 08:53
`background-size: cover` and `background-position: center center` on img element with jQuery
<div class="img-container">
<img src="http://placehold.it/550x800">
</div>
@marcofugaro
marcofugaro / README.md
Last active September 14, 2020 15:16
Paste this in the console of your github profile page and start drawing on your contributions!

Made to work along with gitfiti, you can draw with this tool and then export the data and use it with gitfiti.

##Usage

  1. Paste the code in the console of any github profile page which has the contributions graph
  2. Start drawing! Left click to increment the color, right click to clear the cell, clear button to clear everything! Dragging also works!
  3. Once you're happy you can export the data by typing ContributionsDraw.export() into the console.
  4. Or if you want you can also import existing data with ContributionsDraw.import([...])

NOTE: This is developed for and tested in Chrome, other browsers might not support yet some ES6 stuff, you might need to compile it to ES5.

@marcofugaro
marcofugaro / init.coffee
Last active December 9, 2017 17:32
My atom configuration
# Your init script
#
# Atom will evaluate this file each time a new window is opened. It is run
# after packages are loaded/activated and after the previous editor state
# has been restored.
#
# An example hack to log to the console when each text editor is saved.
#
# atom.workspace.observeTextEditors (editor) ->
# editor.onDidSave ->
@marcofugaro
marcofugaro / Nature of code notes.md
Last active September 27, 2018 22:54
Nature of code notes
@marcofugaro
marcofugaro / accurato.js
Last active December 4, 2020 09:10
Easter egg for the page https://www.accurat.it/about/
//
// $$$$$$$$\ $$$$$$\ $$$$$$\
// $$ _____|$$ __$$\ $$ __$$\
// $$ | $$ / \__|$$ / \__|
// $$$$$\ $$ |$$$$\ $$ |$$$$\
// $$ __| $$ |\_$$ |$$ |\_$$ |
// $$ | $$ | $$ |$$ | $$ |
// $$$$$$$$\ \$$$$$$ |\$$$$$$ |
// \________| \______/ \______/
//
@marcofugaro
marcofugaro / .hyper.js
Last active April 23, 2019 11:29
Hyper sync settings
// Future versions of Hyper may add additional config options,
// which will not automatically be merged into this file.
// See https://hyper.is#cfg for all currently supported options.
module.exports = {
config: {
// choose either `'stable'` for receiving highly polished,
// or `'canary'` for less polished but more frequent updates
updateChannel: 'canary',
@marcofugaro
marcofugaro / autostart
Last active November 18, 2019 16:24
Raspberry PI 4 fullscreen mode script, put this in `~/.config/lxsession/LXDE-pi/autostart`
# Disable screensaver and blank screens
@xset s off
@xset -dpms
@xset s noblank
@xscreensaver -no-splash
# Hide mouse, must have installed unclutter with `sudo apt-get install unclutter`
@unclutter
# Load chromium and open the website in full screen mode