Skip to content

Instantly share code, notes, and snippets.

View tjnine's full-sized avatar

TJ Nine tjnine

View GitHub Profile
@tjnine
tjnine / sublime_shortcuts.md
Last active February 18, 2016 14:30 — forked from ciaranarcher/sublime_shortcuts.md
Sublime Text 2 Shortcuts

Sublime Text 2/3 - Useful Shortcuts (Mac OS X)

General

go to file            | ⌘T
find in project       | ⌘P
go to project         | ⌘⌃P
go to methods         | ⌘R
go to line | ⌃G
<tr>
<td><strong>Credit Card Expiration:<span style="color:#ff0000;">*</span></strong></td>
<td>
<select name="cc_exp_mo" id="cc_exp_mo">
<?php
$month = array (1=>"January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December");
foreach($month as $key=>$val)
{
echo "<option value='" . str_pad($key,2,"0",STR_PAD_LEFT) . "'>" . $val . "</option>";
}
@tjnine
tjnine / for.php
Last active February 3, 2016 21:24
PHP Countries [complete]
<?php
$country_array = array('AF'=>'AFGHANISTAN',
'AL'=>'ALBANIA',
'DZ'=>'ALGERIA',
'AS'=>'AMERICAN SAMOA',
'AD'=>'ANDORRA',
'AO'=>'ANGOLA',
'AI'=>'ANGUILLA',
'AQ'=>'ANTARCTICA',
@tjnine
tjnine / blog.md
Last active January 22, 2016 16:05
Laravel 5.2 Auth Features

##An Overview Seeing how RESTful API's are catching on more and more everyday Laravel makes not only building API's easier but securing those API's. So what is so great about Laravel 5.2's Auth Classes/Components/and Helpers? Well to begin with Laravel 5.2 not only has rate limiting built into 5.2, but it also has the settings setup for you to take advantage of this feature right out of the box.

The ideal setup for securing a API is not always a login page. Instead appending an api_token to the end of a query string and use that to authenticate the API requests. It just so happens that Laravel 5.2 comes with a TokenGuard class that assists in appending api tokens to query strings by implementing the Guard interface. If your unfamiliar with Laravel, Guard is an

@tjnine
tjnine / JavaScript_Form_Dates
Created January 9, 2016 22:18
working with dates and javascript
var x = 1;
while(x<10){
document.write(x + '<br>');
x = x + 1; //// or x++
//return to top and test x<10 again
}//continue program
document.write('<h4>Dates</h4>');
@tjnine
tjnine / get-age-from-dob.php
Created January 8, 2016 19:28 — forked from jgornick/get-age-from-dob.php
PHP: Get age from date of birth
<?php
/**
* Returns the age based on the date of birth.
*
* @return int
*/
function getAgeFromDob()
{
$dob = new \DateTime('1980-01-01');
$dob = $dob->getTimestamp();
@tjnine
tjnine / ubuntu_packages.sh
Created December 15, 2015 00:16
a list of ubuntu commands for some vagrant boxes
$ sudo apt-get install mcrypt php5-mcrypt
$ sudo php5enmod mcrypt
$ sudo service nginx restart
@tjnine
tjnine / .editorconfig
Created December 11, 2015 20:39
an editor config file for PHP
; top-most EditorConfig file
root = true
; Unix-style newlines
[*]
end_of_line = LF
[*.php]
indent_style = space
indent_size = 4
@tjnine
tjnine / .formatter.yml
Created December 11, 2015 20:38
a default php-formatter config file
use-sort:
group:
- _main
- Mmoreram
group-type: each
sort-type: alph
sort-direction: asc
header: |
/*
@tjnine
tjnine / .cs-fixer
Created December 11, 2015 20:27
default php-cs-fixer configuration
// PHP-CS-Fixer settings
// Fix the issues on save
"php_cs_fixer_on_save": true,
// Show the quick panel
"php_cs_fixer_show_quick_panel": true,
// Path to where you have the php-cs-fixer installed
"php_cs_fixer_executable_path": "/usr/local/bin/php-cs-fixer",