Skip to content

Instantly share code, notes, and snippets.

@Lumbe
Lumbe / index.md
Created December 19, 2016 14:23 — forked from rstacruz/index.md
Rails models cheatsheet

Rails Models

Generating models

$ rails g model User

Associations

belongs_to

has_one

@Lumbe
Lumbe / postgresql_configuration_on_ubuntu_for_rails.md
Created April 23, 2018 08:10 — forked from p1nox/postgresql_configuration_on_ubuntu_for_rails.md
PostgreSQL configuration without password on Ubuntu for Rails

Abstract

You could have postgre installed on localhost with password (or without user or password seted after instalation) but if we are developing we really don't need password, so configuring postgre server without password for all your rails project is usefull.

Install Postgre packages

  • postgresql
  • postgresql-client
  • libpq-dev
@Lumbe
Lumbe / add-custom-post-type-menu.php
Created May 5, 2020 14:33 — forked from tommcfarlin/add-custom-post-type-menu.php
[WordPress] Add a custom post type menu as a child of an existing custom post type menu.
<?php
// Define the 'Portfolio' post type. This is used to represent galleries
// of photos. This will be our top-level custom post type menu
$args = array(
'labels' => array(
'all_items' => 'Gallery',
'menu_name' => 'Portfolio',
'singular_name' => 'Gallery',
'edit_item' => 'Edit Gallery',
@Lumbe
Lumbe / wpdb_default_tables.sql
Last active October 30, 2020 18:41 — forked from rnagle/wpdb_default_tables.sql
Default WordPress Database Table Create Statements
DROP TABLE IF EXISTS wp_users;
CREATE TABLE wp_users (
ID bigint(20) unsigned NOT NULL auto_increment,
user_login varchar(60) NOT NULL default '',
user_pass varchar(64) NOT NULL default '',
user_nicename varchar(50) NOT NULL default '',
user_email varchar(100) NOT NULL default '',
user_url varchar(100) NOT NULL default '',
user_registered datetime NOT NULL default '0000-00-00 00:00:00',
user_activation_key varchar(60) NOT NULL default '',
@Lumbe
Lumbe / acf-custom-metabox-on-options-page.php
Created November 3, 2020 09:55 — forked from RadGH/acf-custom-metabox-on-options-page.php
ACF: Display custom metabox on an ACF (sub-) options page
<?php
/**
* Add sub options page with a custom post id
*/
if( function_exists('acf_add_options_page') ) {
acf_add_options_sub_page(array(
'page_title' => 'CSV Sync',
'menu_title' => 'CSV Sync',
'parent_slug' => 'users.php',
@Lumbe
Lumbe / PHP : Spintax
Created November 10, 2020 13:43 — forked from vrushank-snippets/PHP : Spintax
PHP : Spintax
<?PHP
/**
* Spintax - A helper class to process Spintax strings.
* @name Spintax
* @author Jason Davis - http://www.codedevelopr.com/
*/
class Spintax
{
public function process($text)
{