Skip to content

Instantly share code, notes, and snippets.

View tonylegrone's full-sized avatar

Tony Legrone tonylegrone

  • Chronicle
  • Birmingham Alabama
View GitHub Profile
@JesseObrien
JesseObrien / gist:7418983
Last active September 26, 2024 12:40
Bind parameters into the SQL query for Laravel ORM
<?php
class MyModel extends Eloquent {
public function getSql()
{
$builder = $this->getBuilder();
$sql = $builder->toSql();
foreach($builder->getBindings() as $binding)
{
@evantravers
evantravers / README.md
Last active August 29, 2015 13:56
This creates a simple workspace in tmux

Workspace in tmux

I like to work using a separate tmux session for each active project/folder that I'm juggling. This script will either create or attach to a project based on it's name, using fasd to jump to the directory directly. The project will be named based on the basename of the folder, for easy switching using TMUX-s.

@koycarraway
koycarraway / _hoefFont.scss
Last active August 29, 2015 14:05
H&Co Typography Mixin
// H&Co Typography mixin -------------------------------------------------------------
//
// $fontFamily: gotham, Sentinel, whitney
// $fontWeight: light, book, medium, semibold, bold, black
// $SSm: true, false (ScreenSmart Font?)
// $fontStyle: normal, italic
//
// USAGE: @include HoefFont(gotham, bold, true);
@function capitalize($string) {
@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}'";
@sshymko
sshymko / install_mysql_client.sh
Last active March 14, 2024 20:10
Install MySQL 5.7 client on Amazon Linux 2
#!/bin/sh
sudo yum install -y https://dev.mysql.com/get/mysql57-community-release-el7-11.noarch.rpm
sudo yum install -y mysql-community-client