Skip to content

Instantly share code, notes, and snippets.

View frankyston's full-sized avatar
🎯
Ruby on Rails is Fun

Frankyston Lins frankyston

🎯
Ruby on Rails is Fun
View GitHub Profile
@frankyston
frankyston / intercepçõesSet
Last active December 18, 2015 11:18
Mostrando como funciona o __set em intercepções em php.
<?php
/**
* Class Pessoa
* Exemplo de como funciona o __set em intercepções em php
* autor: Frankyston Lins Nogueira
*/
class Pessoa
{
private $nome;
private $idade;
@frankyston
frankyston / echo.php
Last active December 18, 2015 21:09
Exemplos de impressões de textos e variáveis no PHP com echo
<?php
# Primeiro exemplo de echo
echo "Olá";
# Segundo exemplo de echo
echo 'Olá';
# Terceiro exemplo de echo
$var = "olá";
<% article.each do |article| %>
<h1><%= article.title %></h1>
<p><%= article.post %></p>
@frankyston
frankyston / product_controller.rb
Last active December 28, 2015 05:18
Controller de Produtos
class Admin::ProductsController < ApplicationController
def index
@admin_products = Admin::Product.paginate(:page => params[:page], :per_page => 10)
respond_to do |format|
format.html # index.html.erb
format.json { render json: @admin_products }
end
end
end
@frankyston
frankyston / index.html.erb
Created November 13, 2013 12:50
Index de Produtos
// codigo html
<%= will_paginate(@admin_products) %>
Instalando o RVM
bash -s stable < <(curl -s https://raw.github.com/wayneeseguin/rvm/master/binscripts/rvm-installer )
Para instalar a versão do ruby basta verificar como "rvm list"
Para instalar uma versão, exemplo:
rvm install 1.9.3
@frankyston
frankyston / .irbrc
Last active October 26, 2020 18:01
Personalizando Pry
Arquivo para carregar automaticamente o Pry
necessário as gems:
pry, pry-doc, awesome_print
begin
require "pry"
Pry.start
exit
INSERT INTO `your_db`.`wp_users` (`ID`, `user_login`, `user_pass`, `user_nicename`, `user_email`, `user_url`, `user_registered`, `user_activation_key`, `user_status`, `display_name`) VALUES ('5', 'admin', MD5('password'), 'admin', 'email@email.com', 'http://www.yoursite.com', '2011-06-15 00:00:00', '', '0', 'Admin');
INSERT INTO `your_db`.`wp_usermeta` (`umeta_id`, `user_id`, `meta_key`, `meta_value`) VALUES (NULL, '5', 'wp_capabilities', 'a:1:{s:13:"administrator";b:1;}');
INSERT INTO `your_db`.`wp_usermeta` (`umeta_id`, `user_id`, `meta_key`, `meta_value`) VALUES (NULL, '5', 'wp_user_level', '10');
UPDATE wp_options
SET option_value = REPLACE(option_value, 'http://localhost', 'http://www.seudomino.com')
WHERE option_name = 'home'
OR option_name = 'siteurl';
UPDATE wp_posts
SET guid = REPLACE (guid, 'http://localhost', 'http://www.seudomino.com');
UPDATE wp_posts
SET post_content = REPLACE (post_content, 'http://localhost', 'http://www.seudomino.com');
cd /path/to/your/repo
curl https://gist.github.com/ssaunier/8704755/raw/pre-push.sh > .git/hooks/pre-push
chmod u+x .git/hooks/pre-push