Skip to content

Instantly share code, notes, and snippets.

View jpcaparas's full-sized avatar
🐔

Jayps jpcaparas

🐔
View GitHub Profile
@jpcaparas
jpcaparas / 0_reuse_code.js
Created June 15, 2016 22:45
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
@jpcaparas
jpcaparas / PowerShell scripts
Created June 30, 2016 00:01
Windows Server 2012 R2 Useful stuff
- WiNSXS cleanup: Get-WindowsFeature | Where-Object {$_.InstallState -Eq “Available”} | Uninstall-WindowsFeature -Remove
@jpcaparas
jpcaparas / FetchArticleFromID_StoredProcedure.sql
Last active June 30, 2016 21:16
Sandfield CMS Stored procedures
/**
Fetch an article based on its ID:
Fields required:
- Type
- Title
- Description
- Thumbnail
- Published time
- Modified time
/**
Fetch a page based on its ID:
Fields required:
- Title
- Description
- Thumbnail
- Section/category
TODO: On the where clause, specify page ID
@jpcaparas
jpcaparas / pagination-with-separator.php
Last active November 11, 2022 04:26
Create pagination items with a separator
<?php
/**
* Pagination with separators
*
* @see http://stackoverflow.com/posts/6354523/revisions
*
* @param $current_page
* @param $total_pages
* @param int $show_separator_if_more_than
* @param string $separator

Get Command Line Tools

xcode-select --install

Install Brew

ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

Change the paths to load local binaries first instead of system binaries

export PATH="/usr/local/bin:/usr/local/sbin:$PATH"

Install PHP 7

@jpcaparas
jpcaparas / install-xdebug.sh
Last active May 12, 2017 02:54
Enabling PHP 7.0 Xdebug on a Vagrant Debian 8 image
#!/bin/sh
### IMPORTANT: Run this command as sudo ###
### Sample steps ###
# 1. `vagrant ssh` into your machine
# 2. Run `curl http://[raw-url-to-this-script.sh] | sudo sh
### VARS (Change values as needed) ###
XDEBUG_IS_INSTALLED_PATTERN="xdebug.remote_enable=1"
@jpcaparas
jpcaparas / Mongoblog.postman_collection.json
Last active August 8, 2017 02:56
Mongoblog postman collection
{
"variables": [],
"info": {
"name": "Mongoblog",
"_postman_id": "b3c8aae5-ae6a-7e2c-e602-68b704121213",
"description": "",
"schema": "https://schema.getpostman.com/json/collection/v2.0.0/collection.json"
},
"item": [
{
@jpcaparas
jpcaparas / command.sh
Created August 28, 2017 08:48
Quickly test Laravel email capabilities with Tinker
# cd into the app directory
cd <path-to-app>
# Enter the tinker REPL
php artisan tinker
# Run the simple command and check your inbox
@jpcaparas
jpcaparas / debug.sh
Created October 12, 2017 23:23
PHP Storm Xdebug client connect on Vagrant-installed PHP
#!/bin/sh
# - `chmod 777 debug.sh` to make it executable
# - Put this file on your `/usr/bin` dir so you can call it anywhere
# - Rename it to `debug`
# - Change variables as needed
# Usage: debug php artisan
PHP_IDE_CONFIG="serverName=vagrant" \