Skip to content

Instantly share code, notes, and snippets.

@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)
{
@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 / 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 / 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 / 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 / react_libraries.md
Last active June 30, 2017 15:49
Javascript and React libraries

Useful Javascript libraries for Rails 5.1 + React application

  • axios - Promise based HTTP client for the browser and node.js (replace for JQuery for AJAX calls to controller)
  • react-bootstrap - Bootstrap 3 components built with React
  • react-router-dom - DOM bindings for React Router (react-router - declarative routing for React)
  • pluralize - Pluralize and singularize any word
@Lumbe
Lumbe / react_navbar.md
Created June 30, 2017 14:42
react-bootstrap navigation menu with react-router-dom through react-router-bootstrap library

Use navigation menu from react-bootstrap library with react-router-dom library using from react-router-bootstrap library

Example:

import { Route, RouteHandler, Link } from 'react-router';
import AuthService from '../services/AuthService'
import { Button, Nav, Navbar, NavDropdown, MenuItem, NavItem } from 'react-bootstrap';
import { LinkContainer } from 'react-router-bootstrap';
@Lumbe
Lumbe / pg.md
Last active October 23, 2017 10:49
Create PostgreSQL user and database

Create PostgreSQL user and database for development environment

1. Install PostgreSQL

$ sudo apt-get update
$ sudo apt-get install postgresql postgresql-contrib

2. Switch to postgresql user

@Lumbe
Lumbe / rails-yarn.md
Last active October 16, 2023 02:05
add js libraries to rails project with yarn

How to add js library to Ruby on Rails project with yarn

1. Install yarn on your system. For Debian/Ubuntu Linux:

$ curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -
$ echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list
$ sudo apt-get update && sudo apt-get install yarn

2. To add any library, for example jquery, to Ruby on Rails 5.1 application with yarn(from npm) type in terminal:

$ yarn add jquery
@Lumbe
Lumbe / c9-ide.md
Created May 22, 2017 12:49
c9.io tips & tricks
  1. Show disk quota usage(you can see what's taking up all your disk space)
du-c9 | sort -h