Skip to content

Instantly share code, notes, and snippets.

View arodbits's full-sized avatar

Anthony Rodriguez arodbits

View GitHub Profile
@arodbits
arodbits / occurrence-finder.sh
Created September 20, 2017 15:57
find occurrence of a pattern in all files
#!/bin/sh
grep -rnw '/path/to/somewhere/' -e “pattern”
@arodbits
arodbits / unzip-into-another-directory.sh
Created September 20, 2017 15:53
unzip files in another directory
#!/bin/sh
sudo find ./ -type f -name *.zip | awk -F'/' '{print "unzip -n ./"$3"/" $4 " -d ../extracted/"$3"/"}'| sh
@arodbits
arodbits / find-files-and-split-filename-parts.sh
Created September 20, 2017 15:35
unix: find files and split filename's parts
#!bin/sh
#directory: 2014/example.zip
find ./ -type f -name *.zip | awk -F'/' '{print $1}'
#the comand above would print out 2014
@arodbits
arodbits / lowercase_filenames.sh
Created August 28, 2017 21:02
Lowercase filenames
for i in *; do mv $i `echo $i | tr [:upper:] [:lower:]`; done
@arodbits
arodbits / replace_filenames_matching_characters.sh
Created August 28, 2017 20:52
Replace filenames's matching character with another character.
find ./ -type f | while read file; do mv $file `echo $file | tr ' ' '_'` ; done
@arodbits
arodbits / ebl.sh
Created August 18, 2017 17:56
Build local ember files
#Alias for building local ember files.
alias ebl=""RETURNDIR=$PWD && cd /Users/anthonyrodriguez/code/sportsrecruits/local-site/www/sportsrecruits/htdocs/ember_app && ember build --output-path=dist-local --environment=local && cd $RETURNDIR"
@arodbits
arodbits / pre-push.sh
Last active August 21, 2017 14:45
Build ember files for the different sites
#!/bin/sh
set -e
ROOTDIR=$PWD
INSPECTDIR="htdocs/ember_app"
LASTSHA=$(git fetch $1 && git log --oneline -n 1 | awk '{print $1}')
EXISTS=$(git branch -r --contains $LASTSHA)
if [ ${#EXISTS} -gt "0" ]; then
@arodbits
arodbits / binder.php
Last active January 20, 2020 09:55
Combine binding values into a raw SQL query in Laravel. Debugging in Laravel.
<?php
//example:
$query = Foo::where('id', '=', 1)->where('name', '=', 'bar');
//would produce the following raw query:
//select * from foo where id = ? and name = ?;
dd(vsprintf(str_replace('?', '%s', $query->toSql()), collect($query->getBindings())->map(function($binding){
return is_numeric($binding) ? $binding : "'{$binding}'";
@arodbits
arodbits / checkbox-binding-example-1.html
Last active April 2, 2017 14:43
Vue.js - Binding into a checkbox v-model attribute.
<label>Checkbox 1</label>
<input id="checkbox-1" type="checkbox" v-model="my.checkbox.value">
<label>Checkbox 2</label>
<input id="checkbox-2" type="checkbox" v-model="my.checkbox.value">
@arodbits
arodbits / FirstDay.php
Created February 23, 2017 21:18
identifying OOP fundamental parts - SportsRecruits/OOP-workshop
<?php
/*
Research about:
- OOP PHP INHERITANCE
- OOP PHP INTERFACES
- Polymorphism
*/