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
// Sync one or more personal calendars to a work calendar - and you can sync the work calendar back to | |
// your personal calendars too! Put this into a Google Apps Script and set up an hourly trigger. | |
// | |
// IMPORTANT: To run the script, you must enable the "Calendar API" under the "Services" menu on the left | |
// of the Google Apps Script IDE. | |
// | |
// Author: Oliver J. Woodford https://gist.github.com/ojwoodford | |
// Small tweaks: Valerie Aurora | |
function SyncMyCal() { | |
var options = { |
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
<!-- | |
* Copyright (c) 2021 GraphQL Contributors | |
* All rights reserved. | |
* | |
* This code is licensed under the MIT license. | |
* Use it however you wish. | |
--> | |
<!DOCTYPE html> | |
<html> | |
<head> |
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
let a = [null, {status: 'OK'}]; | |
switch_( | |
(err, _) => console.log('error', err), | |
(_, resp) => console.log('response', resp) | |
)(a); | |
// logs 'response' { "status": "OK" } | |
let b = [{err: 401}, null]; |
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
module Editable exposing (..) | |
type Editable ofType | |
= NotEditing { value : ofType } | |
| Editing { originalValue : ofType, buffer : ofType } | |
value : Editable ofType -> ofType | |
value editable = |
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
# You will need fswatch installed (available in homebrew and friends) | |
# The command below will run tests and wait until fswatch writes something. | |
# The --stale flag will only run stale entries, it requires Elixir v1.3. | |
fswatch lib/ test/ | mix test --stale --listen-on-stdin |
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 ast | |
import inspect | |
import os | |
def get_short_lambda_source(lambda_func): | |
"""Return the source of a (short) lambda function. | |
If it's impossible to obtain, returns None. | |
""" | |
try: |
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 DBTransactions do | |
use ExUnit.CaseTemplate | |
setup_all do | |
Ecto.Adapters.SQL.begin_test_transaction(Repo) | |
on_exit fn -> | |
Ecto.Adapters.SQL.rollback_test_transaction(Repo) | |
end | |
end |
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 Lab do | |
defmacro say({:when, _, [message, condition]}) do | |
{result, _} = Code.eval_quoted(quote do | |
case true do | |
true when unquote(condition) -> true | |
true -> false | |
end | |
end) | |
if result do |
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 Lab do | |
defmacro say({:when, _, [message, condition]}) do | |
{result, _} = Code.eval_quoted(condition) | |
if result do | |
quote do | |
IO.puts unquote(message) | |
end | |
end | |
end |
NewerOlder