Skip to content

Instantly share code, notes, and snippets.

View brianium's full-sized avatar
🕊️
Human

Brian Scaturro brianium

🕊️
Human
View GitHub Profile
;;; Multi Method
(defmethod slack/slash :info [{:keys [response-type]}]
{:response_type response-type
:text (str "TeamGantt for Slack v" (version/current))})
(defmethod slack/slash :default [context]
(slack/slash (assoc context :command :help)))
;;; Syntactic sugar
(defmacro defslashcmd
{
"ansel_autostart": false,
"ansel_bg_color": "rgba(0, 0, 0, 1)",
"ansel_constrain_height": true,
"ansel_constrain_height_percent": "100",
"ansel_control_bar_button_color": "rgba(255, 255, 255, 1)",
"ansel_control_bar_button_shadow_color": "rgba(0, 0, 0, 0.5)",
"ansel_controls_bg_color": "",
"ansel_controls_padding_tb": "5px",
"ansel_controls_position": "bottom",
<?php
use Phinx\Config\Config as PhinxConfig;
class Config extends PhinxConfig
{
/**
* {@inheritdoc}
*/
public function getMigrationPath()
<?php
use Phinx\Db\Adapter\AdapterFactory;
use Phinx\Migration\Manager;
use Phinx\Migration\MigrationInterface;
use Symfony\Component\Console\Output\BufferedOutput;
use Symfony\Component\Console\Output\OutputInterface;
class WordPressManager extends Manager implements MigratorInterface
{
@brianium
brianium / MigratorInterface.php
Created March 28, 2017 19:01
Provides an interface that can be implemented by a custom Phinx migration manager
<?php
interface MigratorInterface
{
/**
* Migrate the specified environment to a version. Migrates up if the version is null
*
* @param string $environment
* @param string $version
* @return mixed
@brianium
brianium / PdoLikeObject.php
Created March 28, 2017 19:00
Provides the minimum interface required for Phinx's use of PDO within adapters.
<?php
/**
* Class PdoLikeObject - its like PDO, but not!
*/
class PdoLikeObject
{
/**
* Return the given value after it has been quoted by WordPress' esc_sql function
*
@brianium
brianium / WpdbAdapter.php
Created March 28, 2017 18:58
Barebones Phinx adapter powered by wpdb
<?php
use Phinx\Db\Adapter\AdapterInterface;
use Phinx\Db\Adapter\MysqlAdapter;
use Phinx\Db\Table;
use Phinx\Db\Table\Column;
use Phinx\Db\Table\ForeignKey;
use Phinx\Db\Table\Index;
use Phinx\Migration\MigrationInterface;
use Symfony\Component\Console\Output\NullOutput;
(def i (js/Image.))
(def p (js/Promise. (fn [resolve]
(set! (.-onload i) #(resolve i))
(set! (.-src i) "url.jpg"))))
(.then p (.-log js/console))
(watermark "some-resource.jpg"
(with-image "another-resource.jpg" lower-right)
(with-text "hello world!" my-draw)
(with-image "some-image.jpg" upper-left)
(append-to-thangs))

#Clojure Doc Exploration

Go through them docs

** Last looked at "with-bindings"**

agent

Agents are things. Part of writing async code in clojure

refs