This file contains 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
defmodule TravelerWeb.SearchbarLive do | |
use TravelerWeb, :live_view | |
alias Phoenix.LiveView.JS | |
alias Traveler.Places | |
def mount(_params, _session, socket) do | |
socket = assign(socket, places: []) | |
{:ok, socket, layout: false} | |
end |
This installs a patched ruby 1.9.3-p327 with various performance improvements and a backported COW-friendly GC, all courtesy of funny-falcon.
You will also need a C Compiler. If you're on Linux, you probably already have one or know how to install one. On OS X, you should install XCode, and brew install autoconf
using homebrew.
This file contains 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
// Import the Hubspot NodeJS Client Library - this will allow us to use the HubSpot APIs | |
const hubspot = require('@hubspot/api-client'); | |
/* | |
This function is called when the custom code action is executed. It takes 2 arguements. The first is the event object which contains information on the currently enrolled object. | |
The second is the callback function which is used to pass data back to the workflow. | |
*/ | |
exports.main = (event, callback) => { | |
// Instantiate a new HubSpot API client using the HAPI key (secret) |
These snippets provide a foundation for starting and stopping supervision trees at runtime using feature flags (e.g. Launch Darkly).
Some things to note when adapting these snippets:
- application.ex needs to be adapted into an existing application. The important part is that each child spec provided is compliant, and that there is a feature flag (
ld_key
) specified. - As written, if a feature flag fails for some reason, it defaults to starting all children. There is room for adaptation here as needed.
- This implementation will still require a
FeatureFlags
module to be available that implementsis_on?/2
. Adjust as needed to accomodate your own feature flag setup.
Problem: Convert nested structs or nested encoded maps into a decoded map and remove keys with nil values.
Solution: Walk the structure and convert all structures to decoded map.
Before (nested struct):
%TopLevelStuct{
_type: "Purchase",
account_key: "ZBmrcY7sv47nCaZOx5TXBTJuazy"
This file contains 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
/** | |
* Fancy ID generator that creates 20-character string identifiers with the following properties: | |
* | |
* 1. They're based on timestamp so that they sort *after* any existing ids. | |
* 2. They contain 72-bits of random data after the timestamp so that IDs won't collide with other clients' IDs. | |
* 3. They sort *lexicographically* (so the timestamp is converted to characters that will sort properly). | |
* 4. They're monotonically increasing. Even if you generate more than one in the same timestamp, the | |
* latter ones will sort after the former ones. We do this by using the previous random bits | |
* but "incrementing" them by 1 (only in the case of a timestamp collision). | |
*/ |
This file contains 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 git log alias. | |
# Shows the brief log describtion in one line. | |
# Adds colors, a relative date and the owner. | |
# File name: .gitconfig | |
[alias] | |
look = log --graph --pretty=format:'%Cred %h : %Creset%s %Cgreen(%cr) %C(blue)<%an>%C(yellow)%d %Creset' --date=relative |
This file contains 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
<!DOCTYPE html> | |
<html> | |
<body> | |
<div id="src">Source here...</div> | |
<div id="editor" contenteditable="true"> | |
<p>Place MS-Word text here...</p> | |
</div> | |
</body> | |
</html> |
This file contains 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
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta http-equiv="content-type" content="text/html; charset=UTF-8"> | |
<title>WebKit contentEditable focus bug workaround</title> | |
<script type='text/javascript' src='http://code.jquery.com/jquery-1.6.2.js'></script> | |
<script type='text/javascript'> | |
//<![CDATA[ | |
$(function(){ |
NewerOlder