Skip to content

Instantly share code, notes, and snippets.

View rodriguesmarcos's full-sized avatar

Marcos Rodrigues rodriguesmarcos

  • Rio de Janeiro, Brazil
View GitHub Profile
@rodriguesmarcos
rodriguesmarcos / Antonyms.md
Created April 24, 2022 19:49 — forked from maxtruxa/Antonyms.md
A list of common terms used in programming and their respective antonyms.

Antonym List

Note: The table headings (positive/negative) are not necessarily meaningful.

Positive Negative
acquire release
add remove (e.g. an item), subtract (arithmetic)
advance retreat
allocate deallocate (correct), free (common)
allow deny
@rodriguesmarcos
rodriguesmarcos / filterArray.js
Created July 1, 2021 17:34 — forked from jherax/arrayFilterFactory.1.ts
Filters an array of objects with multiple match-criteria.
/**
* Filters an array of objects using custom predicates.
*
* @param {Array} array: the array to filter
* @param {Object} filters: an object with the filter criteria
* @return {Array}
*/
function filterArray(array, filters) {
const filterKeys = Object.keys(filters);
return array.filter(item => {
@rodriguesmarcos
rodriguesmarcos / Button.js
Created April 3, 2020 16:14
React Native Button
import React from 'react';
import { ViewPropTypes, Text } from 'react-native';
import PropTypes from 'prop-types';
import { Container, ButtonInner, ButtonActivityIndicator, ButtonText } from './styles';
const Button = ({
text,
themeStyle,
onPress,
@rodriguesmarcos
rodriguesmarcos / wordpress-firebase.php
Created November 14, 2017 13:40 — forked from derekconjar/wordpress-firebase.php
An example of using Firebase and WordPress together. The idea is to use WP's custom post types and metaboxes to make content management easy, and sync with Firebase so that your websites have access to a real-time JSON feed of your custom data.
<?php
/**
* All custom functions should be defined in this class
* and tied to WP hooks/filters w/in the constructor method
*/
class Custom_Functions {
// Custom metaboxes and fields configuration
@rodriguesmarcos
rodriguesmarcos / custom-post-taxonomy-permalinks.php
Created August 19, 2017 13:55 — forked from kasparsd/custom-post-taxonomy-permalinks.php
Create permalink structure URLs for custom post types that include all parent terms from a custom taxonomy
<?php
/*
Term Archive Pages:
- http://example.com/recipes/dinner/
- http://example.com/recipes/breakfast,brunch/
Single Recipe Pages:
- http://example.com/recipes/dinner/soup-title/
<?php
function my_pre_user_query( $query ) {
$where = get_posts_by_author_sql( 'post' ) . " AND MONTH(post_date) = " . date( 'm', strtotime( '-1 month' ) );
$query->query_from = str_replace( get_posts_by_author_sql( 'post' ), $where, $query->query_from );
$query->query_where .= " AND post_count > 0 ";
$query->query_limit .= " LIMIT 5 ";
}
function my_magic_loop() {
@rodriguesmarcos
rodriguesmarcos / Reload Gravity Form Link
Created August 25, 2016 16:03
This snippet allows the form to be reloaded by including the following link in the confirmation message: <a href="" id="reload-form">Submit this form again?</a> You can customize the text of link, but leave the "id" attribute as is.
@rodriguesmarcos
rodriguesmarcos / 0_reuse_code.js
Created August 24, 2014 22:03
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
// for debug : trace every event
/*var originalTrigger = wp.media.view.MediaFrame.Post.prototype.trigger;
wp.media.view.MediaFrame.Post.prototype.trigger = function(){
console.log('Event Triggered:', arguments);
originalTrigger.apply(this, Array.prototype.slice.call(arguments));
}*/
// custom state : this controller contains your application logic
wp.media.controller.Custom = wp.media.controller.State.extend({