This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Get the current user that will be the origin of our operations | |
$currentUser = User::find(10); | |
// Get ID of a User whose autoincremented ID is less than the current user, but because some entries might have been deleted we need to get the max available ID of all entries whose ID is less than current user's | |
$previousUserID = User::where('id', '<', $currentUser->id)->max('id'); | |
// Same for the next user's id as previous user's but in the other direction | |
$nextUserID = User::where('id', '>', $currentUser->id)->min('id'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
HTML::macro('table', function($fields = array(), $table_fields = array(), $data = array(), $resource, $status = true, $showEdit = true, $showDelete = true, $showView = true) | |
{ | |
$table = '<table id="sample-table-2" class="table table-striped table-bordered table-hover well datatables">'; | |
$table .='<thead>'; | |
$table .='<tr>'; | |
foreach ($table_fields as $table_field) | |
{ | |
$table .= '<th>' . Str::title($table_field) . '</th>'; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
The JavaScript | |
It's important to point out that Titanium's Titanium.XML.DOMDocument object implements DOM2-level structures. Here's the magic XML to JSON code: | |
*/ | |
// Changes XML to JSON | |
function xmlToJson(xml) { | |
// Create the return object | |
var obj = {}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- mode: ruby -*- | |
# vi: set ft=ruby : | |
# Vagrantfile API/syntax version. Don't touch unless you know what you're doing! | |
VAGRANTFILE_API_VERSION = "2" | |
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| | |
config.vm.box = "base" | |
config.vm.box_url = "http://files.vagrantup.com/precise32.box" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
### Install guide | |
sudo apt-get update | |
sudo apt-get install wkhtmltopdf | |
sudo apt-get install xvfb | |
echo 'xvfb-run --server-args="-screen 0, 1024x768x24" /usr/bin/wkhtmltopdf $*' > /usr/bin/wkhtmltopdf.sh | |
chmod a+x /usr/bin/wkhtmltopdf.sh | |
ln -s /usr/bin/wkhtmltopdf.sh /usr/local/bin/wkhtmltopdf | |
wkhtmltopdf http://www.google.com output.pdf | |
######################################################## |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Common | |
alias ..="cd .." | |
alias ...="cd ../.." | |
alias h='cd ~' | |
alias c='clear' | |
alias ll='ls -lahG' | |
# Test | |
alias codecept='vendor/bin/codecept' | |
alias crf='codecept run functional' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"installed_packages": | |
[ | |
"AdvancedNewFile", | |
"Alignment", | |
"All Autocomplete", | |
"AutoFileName", | |
"Autoprefixer", | |
"Blade Snippets", | |
"BracketHighlighter", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"bold_folder_labels": true, | |
"caret_style": "phase", | |
"color_scheme": "Packages/User/base16-eighties.dark (SL).tmTheme", | |
"default_line_ending": "unix", | |
"draw_white_space": "all", | |
"ensure_newline_at_eof_on_save": true, | |
"fallback_encoding": "UTF-8", | |
"folder_exclude_patterns": | |
[ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Gets the HTTP status code for the given URL. | |
* | |
* @param string $url The URL to check. | |
* @return int | |
*/ | |
function url_http_status($url) { | |
$ch = curl_init($url); |
OlderNewer