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 | |
use Illuminate\Database\Eloquent\Builder; | |
Builder::macro('toSqlWithBindings', function () { | |
$bindings = array_map( | |
fn ($value) => is_numeric($value) ? $value : "'{$value}'", | |
$this->getBindings() | |
); |
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
{ | |
"Twill input regular": { | |
"scope": "php,blade", | |
"prefix": "tinput", | |
"body": [ | |
"@formField('input', [", | |
" 'name' => '${1:name}',", | |
" 'label' => '${1:label}',", | |
"])" |
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
#Files larger than 10 MB in current Directory | |
find . -xdev -size +10M -exec ls -lh {} \; | |
#Files larger than 1GB in current Directory | |
find . -xdev -size +1G -exec ls -lh {} \; | |
#Files larger than 1GB from Root | |
sudo find / -xdev -size +1G -exec ls -lh {} \; | |
#Files larger than 1GB in folder folder1 |
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
#Simple tree that will look as an arrow :D | |
height = 20 | |
((1..height).to_a+[6]*height.div(5)).map do |i| | |
puts ('*'*i*2).center(80) | |
end | |
#Simple tree that look more like a doodle christmas tree | |
height = 20 | |
( |
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
find ~ -name '*.log' -print0 | xargs -0 -L1 stat -f'%z %N' | sort -rn | tee fat-logfiles.txt | head | |
awk '{ total += $1 } END { printf "total: %5.2f MiB\n", total/1024/1024 }' < fat-logfiles.txt |
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
######################################### | |
# Very basic rack application showing how to use a router based on the uri | |
# and how to process requests based on the HTTP method used. | |
# | |
# Usage: | |
# $ rackup rack_example.ru | |
# | |
# $ curl -X POST -d 'title=retire&body=I should retire in a nice island' localhost:9292/ideas | |
# $ curl -X POST -d 'title=ask Satish for a gift&body=Find a way to get Satish to send me a gift' localhost:9292/ideas | |
# $ curl localhost:9292/ideas |
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
require "uri" | |
(URI::REGEXP.constants - ["PATTERN"]).each do |rc| | |
puts "#{rc}: #{URI::REGEXP.const_get(rc)}" | |
end | |
URI::REGEXP::PATTERN.constants.each do |pc| | |
puts "#{pc}: #{URI::REGEXP::PATTERN.const_get(pc)}" | |
end |
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
#1 download mingw-w32-1.0-bin_i686-darwin_20110429.tar.bz2 | |
http://sourceforge.net/projects/mingw-w64/files/Toolchains%20targetting%20Win32/Automated%20Builds/mingw-w32-1.0-bin_i686-darwin_20110429.tar.bz2/download | |
#2 extract ~/mingw/w32 | |
#3 add ~/mingw/w32/bin to $PATH | |
#4 rake-compiler cross-ruby HOST=i686-w32-mingw32 |
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
=Navigating= | |
visit('/projects') | |
visit(post_comments_path(post)) | |
=Clicking links and buttons= | |
click_link('id-of-link') | |
click_link('Link Text') | |
click_button('Save') | |
click('Link Text') # Click either a link or a button | |
click('Button Value') |