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
Model:: | |
/*Select*/ | |
select('col1','col2') | |
->select(array('col1','col2')) | |
->select(DB::raw('businesses.*, COUNT(reviews.id) as no_of_ratings, IFNULL(sum(reviews.score),0) as rating')) | |
->addSelect('col3','col4') | |
->distinct() // distinct select | |
/*From*/ |
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 | |
namespace App\Support; | |
class HigherOrderOptionalProxy | |
{ | |
/** | |
* The target being transformed. | |
* Use _ prefix to avoid namespace conflict on __get() | |
* |
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 | |
# Implements a recursive null object pattern. | |
# | |
# Implemented as a trait so any object can make it's properties use | |
# the null pattern without resorting to inheritance. | |
# | |
# The goal is so you can pull data off a partially populated object | |
# without excessive existance checks. | |
trait NullPattern { |
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
#!/bin/bash | |
open -a "Google Chrome" --new --args --new-window \ | |
'https://tweetdeck.twitter.com' \ | |
'https://web.whatsapp.com' \ | |
'https://blastersystems.slack.com/' \ | |
'https://www.messenger.com/' \ | |
'https://web.telegram.org/' \ | |
'https://web.skype.com' \ | |
'https://hangouts.google.com/' \ |
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 | |
Collection::macro('maxBy', function ($callback) { | |
$callback = $this->valueRetriever($callback); | |
return $this->reduce(function ($result, $item) use ($callback) { | |
if ($result === null) { | |
return $item; | |
} | |
return $callback($item) > $callback($result) ? $item : $result; |
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
-- A global variable for the Hyper Mode | |
k = hs.hotkey.modal.new({}, "F17") | |
-- Trigger existing hyper key shortcuts | |
k:bind({}, 'm', nil, function() hs.eventtap.keyStroke({"cmd","alt","shift","ctrl"}, 'm') end) | |
-- OR build your own | |
launch = function(appname) |
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
-- watch for changes | |
hs.pathwatcher.new(os.getenv("HOME") .. "/.hammerspoon/", hs.reload):start() | |
-- | |
-- start custom config | |
-- |
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
-- Hotkey mash | |
local mash = {"cmd", "alt", "ctrl"} | |
local mash_move = {"cmd", "ctrl"} | |
local mash_app = {"shift","ctrl","alt"} | |
hs.alert("Reloaded Config") | |
-- instant window resizing | |
hs.window.animationDuration = 0 |
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
local workApplications = { 'Mail','HipChat','PhpStorm','Safari','Charles'} | |
local workApplicationWatcher; | |
hs.hotkey.bind({"cmd", "alt", "ctrl"}, "H", function() | |
hs.notify.new({title="Hammerspoon", informativeText="Setting home layout"}):send() | |
local homeMonitor = "LG ULTRAWIDE" | |
local windowLayout = { | |
{"PhpStorm", nil, homeMonitor, {x=0, y=0, w=0.6, h=1}, nil, nil}, | |
{"Charles", nil, homeMonitor, {x=0.6, y=0.6, w=0.4, h=0.4}, nil, nil}, |
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
--[[ | |
installation: put this file in ~/.hammerspoon and add this line to your init.lua: | |
local cheaphints = require "cheaphints" | |
usage: by default, just hit cmd+alt+E. you'll see a list of keys and associated | |
windows. if you hit escape, you'll exit hint mode. if you hit one of the keys in | |
the list, that window gets focused. the hint mode will exit automatically after | |
a while. | |
]] |