Skip to content

Instantly share code, notes, and snippets.

@bjorntheart
bjorntheart / machine.js
Created April 30, 2021 10:40
Generated by XState Viz: https://xstate.js.org/viz
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
@bjorntheart
bjorntheart / machine.js
Created April 30, 2021 10:39
Generated by XState Viz: https://xstate.js.org/viz
const policyMachine = Machine(
{
id: 'policy',
initial: 'idle',
context: {
policy: "",
},
states: {
idle: {
@bjorntheart
bjorntheart / machine.js
Created April 29, 2021 13:57
Generated by XState Viz: https://xstate.js.org/viz
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
from pusher import Pusher
pusher = Pusher(
app_id=u'APP_ID',
key=u'APP_KEY',
secret=u'APP_SECRET',
cluster=u'APP_CLUSTER'
)
pusher.trigger(u'test_channel', u'my_event', {u'message': u'hello world'})
@bjorntheart
bjorntheart / sort-colors.php
Created October 28, 2015 15:36
Sort colors from darkest to lightest
<?php
/**
* Sort colors from dark to light
* http://stackoverflow.com/questions/20213421/sorting-color-selections-on-brightness
*/
private static function sortColors($colors) {
usort(
$colors,
function ($one, $two) {
return self::colorToLum($one) - self::colorToLum($two);
@bjorntheart
bjorntheart / 0_reuse_code.js
Last active August 29, 2015 14:17
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@bjorntheart
bjorntheart / ruby-irb-repl.md
Last active August 29, 2015 14:16
Who is this irb REPL guy?

irb, or Interactive Ruby Shell, is a REPL that ships with Ruby. It allows you to experiment with the Ruby programming language in realtime. You start irb from the command line, enter some Ruby code, and irb prints out the results for you.

You'd have to install Ruby to use irb, but installing Ruby is beyond the scope of this article.

Using irb

To start the interactive shell run the command irb and you will see the following output

2.2.0 :001 >

So, you might be asking yourself, what is Gistlog?

Gistlog is a blogging "platform" for people who want to quickly write and publish content, in Markdown, and don't want to bother with yet another platform and yet another login and yet another group hoarding their content. With Gistlog, you use your pre-existing Github login, you store the data in your own Github account, and you can publish with a single click.

Using Gistlog

  1. Create a public gist with a single file using Markdown. Set the gist description to be the title of your blog post
  2. Copy the gist URL, and paste it into the text box on the Gistlog home page
  3. Copy your resulting URL and share it as your blog post--note that it will be in the form of http://gistlog.co/your-github-username/gist-id
<?php namespace Illuminate\Support\Facades;
use Mockery\MockInterface;
abstract class Facade {
/**
* The application instance being facaded.
*
* @var \Illuminate\Foundation\Application
<?php namespace Illuminate\Support\Facades;
class Form extends Facade {
/**
* Get the registered name of the component.
*
* @return string
*/
protected static function getFacadeAccessor() { return 'form'; }