Skip to content

Instantly share code, notes, and snippets.

View jorwan's full-sized avatar

Jorge Wander Santana Ureña jorwan

View GitHub Profile
<!-- index.html.erb -->
<% form_tag search_path do %>
<%= select :search, :state, State.all.collect { |m| [m.full_name, m.id] }.sort, {:prompt=>'Please Select...'} %>
<%= observe_field(:state, :url => { :action => :update_city_menu },
:update => :city_field_div,
:with => :state
) %>
<div id="city_field_div"></div>
<%= submit_tag 'Submit' %>
<?php
$formMatch = array();
$code = '<form name="otro_texto_que_sacare">texto_que_sacare</form>';
preg_match_all("/<form (.*?)>(.*?)<\/form>/i", $code, $matches, PREG_SET_ORDER);
foreach ($matches as $data)
{
print_r($data);
}
@jorwan
jorwan / GET_POST_REQUEST
Last active August 29, 2015 14:03
Ruby
require 'net/http'
require 'json'
#HACER UN GET REQUEST
def getRequest(url)
url = URI.parse(url)
req = Net::HTTP::Get.new(url.path)
res = Net::HTTP.start(url.host, url.port) {|http|
http.request(req)
}
#!/usr/bin/env bash
# Install dependencies
yum update -y
yum install -y gcc apr-devel apr-util-devel openssl-devel pcre-devel libxml2-devel libcurl-devel
# Or just make your own installation for apr
mkdir setup && cd setup
wget <url_to_apache>.tar.gz
tar -zxvf <apache>.tar.gz
@jorwan
jorwan / commands
Created August 6, 2014 20:07 — forked from frangeris/commands
LOCK FILE +, UNLOCK - chattr -i /etc/httpd/conf/httpd.conf
NETWORKING
ifconfig eth0 up
history | grep ifconfig
ifconfig eth0:1 <ip>
tracert <domain>
watch "echo stats | nc 127.0.0.1 11211"
FILE PERMISSIONS
@jorwan
jorwan / git_commands
Last active August 29, 2015 14:06 — forked from frangeris/commands.md
GIT
===
[PUBLIC REPO] https://www.kernel.org/pub/software/scm/git/
[DELETE ALL RM] git rm $(git ls-files --deleted)
[DELETE BRANCH DOWN] git branch <branchName> --delete
[DELETE BRANCH UP] git push origin --delete <branchName>
@jorwan
jorwan / GIT
Last active August 29, 2015 14:14 — forked from dasdo/GIT.md
--------------------
Configuracion Basica
--------------------
//Configurarar Nombre que salen en los commits\\
git config --global user.name "daniel sanchez"
//Configurar Email\\
git config --global user.email dasdo1@gmail.com
//marco de colores para los comandos\\
git config --global color.ui true
# config valid only for Capistrano 3.1
lock '3.2.1'
# APPLICATION
set :application, '<application_name>'
set :repo_url, '<repo>'
# GIT
set :deploy_to, '<deploy_to>'
set :deploy_via, :remote_cache
<?php
/* * **
*
* This script converts an existing MySQL database to migrations in Laravel 4.
*
* 1. Place this file inside app/controllers/
*
* 2. In this file, edit the index() method to customize this script to your needs.
* - inside $migrate->ignore(), you pass in an array of table
@jorwan
jorwan / 0_reuse_code.js
Last active August 29, 2015 14:19
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