Skip to content

Instantly share code, notes, and snippets.

View ivorpad's full-sized avatar
🇪🇸
Working from Spain

Ivor ivorpad

🇪🇸
Working from Spain
View GitHub Profile
@ivorpad
ivorpad / setup-gh-cli-auth-2fa.md
Created December 3, 2020 22:08 — forked from ateucher/setup-gh-cli-auth-2fa.md
Setup git on the CLI to use 2FA with GitHub

These are instructions for setting up git to authenticate with GitHub when you have 2-factor authentication set up. This authentication should be inherited by any GUI client you are using. These are intentionally brief instructions, with links to more detail in the appropriate places.

  1. Download and install the git command-line client (if required).

  2. Open the git bash window and introduce yourself to git (if required):

    git config --global user.name 'Firstname Lastname'
    git config --global user.email '[email protected]'
    
@ivorpad
ivorpad / webpack-setup.md
Created November 15, 2016 20:16 — forked from 1Marc/webpack-setup.md
Webpack Setup

To set up the project you’ll need:

  • Node version 6 (you can install it with nvm)
  • npm version 3 (comes with Node 6)
  • git

Then run these commands:

git clone https://github.com/kentcdodds/es6-todomvc.git
@ivorpad
ivorpad / custom_view.js
Created October 25, 2016 10:49 — forked from pavelthq/custom_view.js
Visual Composer: Custom markup element example
window.VcCustomElementView = vc.shortcode_view.extend( {
elementTemplate: false,
$wrapper: false,
changeShortcodeParams: function ( model ) {
var params;
window.VcCustomElementView.__super__.changeShortcodeParams.call( this, model );
params = _.extend( {}, model.get( 'params' ) );
if ( ! this.elementTemplate ) {
this.elementTemplate = this.$el.find( '.vc_custom-element-container' ).html();
@ivorpad
ivorpad / sanitize_checkbox.php
Created June 30, 2016 19:25 — forked from saas786/sanitize_checkbox.php
Sanitization of customizer controls
/*
* Sanitize Checkbox
*/
// Source: https://github.com/FlagshipWP/flagship-library/blob/develop/customizer/classes/customizer-base.php
/**
* Sanitize a checkbox to only allow 0 or 1
*
* @since 1.2.0
* @access public

Admin and Markdown

Installing an Administration System

One of the big problems with our blog is that we're using HTTP Basic Authentication to prevent anyone from creating and editing blog posts and that the links to perform these actions are right there in the blog. Instead we'd prefer to have an admin panel where we could manage our blog posts. We could build one from scratch but there's a fantastic gem called ActiveAdmin which we can use to

@ivorpad
ivorpad / index.md
Created November 3, 2015 20:28 — forked from rstacruz/index.md
Rails models cheatsheet

Rails Models

Generating models

$ rails g model User

Associations

belongs_to

has_one

@ivorpad
ivorpad / The Technical Interview Cheat Sheet.md
Last active August 29, 2015 14:28 — forked from tsiege/The Technical Interview Cheat Sheet.md
This is my technical interview cheat sheet. Feel free to fork it or do whatever you want with it. PLEASE let me know if there are any errors or if anything crucial is missing. I will add more links soon.

Studying for a Tech Interview Sucks, so Here's a Cheat Sheet to Help

This list is meant to be a both a quick guide and reference for further research into these topics. It's basically a summary of that comp sci course you never took or forgot about, so there's no way it can cover everything in depth. It also will be available as a gist on Github for everyone to edit and add to.

Data Structure Basics

###Array ####Definition:

  • Stores data elements based on an sequential, most commonly 0 based, index.
  • Based on tuples from set theory.
@ivorpad
ivorpad / 0_reuse_code.js
Last active August 29, 2015 14:28
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
<?php
/*
Register Fonts
*/
function studio_fonts_url() {
$font_url = '';
/*
Translators: If there are characters in your language that are not supported
by chosen font(s), translate this to 'off'. Do not translate into your own language.
@ivorpad
ivorpad / capybara cheat sheet
Last active August 29, 2015 14:27 — forked from zhengjia/capybara cheat sheet
capybara cheat sheet
=Navigating=
visit('/projects')
visit(post_comments_path(post))
=Clicking links and buttons=
click_link('id-of-link')
click_link('Link Text')
click_button('Save')
click('Link Text') # Click either a link or a button
click('Button Value')