Skip to content

Instantly share code, notes, and snippets.

Avatar
💻
dustin n' hustlin' n' d' base

rm "rhz" rmrhz

💻
dustin n' hustlin' n' d' base
View GitHub Profile
@rmrhz
rmrhz / servers.cmd
Created Nov 23, 2018
Any *AMP sucks, so I have my own.
View servers.cmd
@echo off
:: WEMP Runner
:: rhz <rmrhz@tfwno.gf>
SETLOCAL
:: Server Runner
SET "root=%CD:~0,3%"
SET "dev=dev\"
View composer.json
{
"require": {
"vlucas/phpdotenv": "^2.5@dev",
"jeremykendall/php-domain-parser": "~2.0"
}
}
@rmrhz
rmrhz / Request.php
Last active Jul 11, 2016
Making Requests and validation easier and less redundant.
View Request.php
<?php
namespace App\Http\Requests;
use Illuminate\Foundation\Http\FormRequest;
abstract class Request extends FormRequest
{
/**
* Validation rules
@rmrhz
rmrhz / labs.dev.conf
Created Jun 15, 2016
Wildcard subdomain + directory Nginx setup
View labs.dev.conf
server {
listen 80;
server_name ~^(?<subdomain>.*)\.labs.dev$;
root "/srv/labs/$subdomain/public";
index index.php;
location / {
try_files $uri $uri/ /index.php?$query_string;
}
View foo.html
<div field='field_name'>
<span class='editable' data-field='field_name'>bar</span>
</div>
@rmrhz
rmrhz / Controller.php
Created Nov 30, 2015
Automatically return a JSON response when `return` is invoked
View Controller.php
<?php
use Phalcon\Mvc\View;
class Controller extends \Phalcon\Mvc\Controller
{
/**
*
* @return \Phalcon\Http\Response
*/
@rmrhz
rmrhz / Repository.php
Created Oct 12, 2015
An impractical use for mass assignments in Laravel.
View Repository.php
<?php
class Repository
{
/**
* Mass assignment based on fillable, hidden, and guarded attributes
*
* @param obj $model
* @param arr $insertArray
@rmrhz
rmrhz / nginx.sh
Created Jan 10, 2015
Install latest Nginx on CentOs 6.*
View nginx.sh
# Install Nginx
echo "Installing Nginx.."
sleep 2
cat <<EOF > /etc/yum.repos.d/nginx.repo
[nginx]
name=nginx repo
baseurl=http://nginx.org/packages/centos/6/\$basearch/
gpgcheck=0
enabled=1
EOF
@rmrhz
rmrhz / dl.rb
Created Dec 30, 2014
Simple HTTPAuth based Ruby downloader
View dl.rb
require 'open-uri'
urls = [
'http://example.com/image.jpg',
'http://example.com/image2.jpg'
]
urls.each do |url|
open(url, :http_basic_authentication => [user, pass]) {|f|
File.open(File.basename(url),"wb") do |file|
@rmrhz
rmrhz / spammer.rb
Created Dec 17, 2014
Spams a certain URL with an 'effin parameter
View spammer.rb
require 'curb'
x = 500
i = 0
while x > i do
# Creates a random string
o = [('a'..'z'), ('A'..'Z')].map { |i| i.to_a }.flatten
string = (0...10).map { o[rand(o.length)] }.join
You can’t perform that action at this time.