Skip to content

Instantly share code, notes, and snippets.

View mariordev's full-sized avatar
💻
Coding...

Mario mariordev

💻
Coding...
  • California, USA
View GitHub Profile
@mariordev
mariordev / jekyll-json-sort.html
Last active August 17, 2020 23:31
Quick example of how to sort data from a json file in Jekyll
<!-- In this example site.data.items points to a file named items.json in the _data folder -->
<!-- Replace "date" with the name of the field you want to sort by -->
{% assign sortedItems = site.data.items | sort: "date" | reverse %}
<ul>
{% for item in sortedItems %}
<li>{{ item.title }} {{ item.date }}</li>
{% endfor %}
</ul>
@mariordev
mariordev / .php_cs
Last active March 14, 2020 23:47
My php cs fixer config file
<?php
return PhpCsFixer\Config::create()
->setRules(array(
'@PSR2' => true,
'array_indentation' => true,
'array_syntax' => array('syntax' => 'short'),
'combine_consecutive_unsets' => true,
'method_separation' => true,
'no_multiline_whitespace_before_semicolons' => true,
'single_quote' => true,
$('#modal').on('hide.bs.modal', function (e) {
$("#videoID").get(0).pause();
})
@mariordev
mariordev / us-canada-states.sql
Created May 10, 2016 17:40
Insert statements to seed a table with US and Canadian states.
INSERT INTO states(state_code,state_name,country_code) VALUES ('AL','Alabama','US');
INSERT INTO states(state_code,state_name,country_code) VALUES ('AK','Alaska','US');
INSERT INTO states(state_code,state_name,country_code) VALUES ('AZ','Arizona','US');
INSERT INTO states(state_code,state_name,country_code) VALUES ('AR','Arkansas','US');
INSERT INTO states(state_code,state_name,country_code) VALUES ('CA','California','US');
INSERT INTO states(state_code,state_name,country_code) VALUES ('CO','Colorado','US');
INSERT INTO states(state_code,state_name,country_code) VALUES ('CT','Connecticut','US');
INSERT INTO states(state_code,state_name,country_code) VALUES ('DE','Delaware','US');
INSERT INTO states(state_code,state_name,country_code) VALUES ('DC','District of Columbia','US');
INSERT INTO states(state_code,state_name,country_code) VALUES ('FL','Florida','US');
@mariordev
mariordev / railscasts.css
Last active February 2, 2016 22:25
Style sheet to highlight code snippets with Rouge in Jekyll 3
pre {
position: relative;
background-color: #232323;
margin-bottom: 40px;
overflow-x: scroll;
font-size: 13px;
color: #E6E1DC;
border: none;
line-height: 1.9em;
}
@mariordev
mariordev / zip-file-in-php-laravel
Last active January 28, 2016 03:58
Zip a File in PHP/Laravel
$temp_files[] = self::saveJsonFile($account_id . '_accounts.json', $data);
// Zip it all up!
$storage = storage_path() . '/archive/';
$zip_file = $account_id . '_archive_' . time() . '.zip';
$zip = new ZipArchive;
$open = $zip->open($storage . $zip_file, ZipArchive::CREATE);
if ($open === true) {