Skip to content

Instantly share code, notes, and snippets.

View arsduo's full-sized avatar

Alex Koppel arsduo

View GitHub Profile
@arsduo
arsduo / gist:1f5408da027fd1ffd1718e962925cec4
Created April 1, 2021 02:55
Facebook Recruiter Response (feel free to use!)
Hi $recruiter_name,
Thanks for the email!
$your_positive_impact(optional)
Facebook, in that same time period, has built an impressive (and well-reported) track record of its own, with accomplishments ranging from real name policies that made life dangerous for trans people, to the use of WhatsApp to spread dangerous viral rumors in places with histories of mob violence, to actively strategizing with political disinformation campaigns in order to maximize advertising revenue, to allowing popular conservative sites and personalities to violate Facebook's terms of service because conspiracy theories get more clicks.
All of which is to say, as fantastic as an opportunity to be paid in Facebook's still-upcoming cryptocurrency would be, I’m afraid I must regretfully decline.
@arsduo
arsduo / elm-event-logging-batch.elm
Created October 23, 2018 10:15
Elm Batched Logging Example
type Msg
= SendBatchLogEvents
| BatchEventLogSuccessful Int
type alias EventData =
{ message : String
, data : Json.Encode.Value
}
@arsduo
arsduo / MessageLogger.js
Created October 16, 2018 11:09
Batched Elm Event Logger in JS
export default class MessageLogger {
constructor() {
this.eventQueue = [];
}
eventReceived(eventData) {
this.eventQueue.push(eventData);
}
uploadMessages() {
type Msg
= PlayVideo VideoId
| VideoPlayAdvanced { currentSecond : Int, totalLength : Int }
| ReadTextAloud
| Login AuthToken UserInformation
logMessage : Msg -> Maybe { message : String, data : Json.Encode.Value }
logMessage msg =
case msg of
@arsduo
arsduo / elm-debug-tostring-logging-example.elm
Last active October 15, 2018 13:22
Elm Debug.toString Logging Example
type Msg
= PlayVideo VideoId
| VideoPlayAdvanced { currentSecond : Int, totalLength : Int }
| ReadTextAloud
| Login AuthToken UserInformation
sendLogMessage : Msg -> Cmd Msg
sendLogMessage msg =
LoggingApi.sendLogEvent (Debug.toString msg)
@arsduo
arsduo / elm-event-logging-example.elm
Last active September 28, 2018 20:03
Event logging in Elm
{- Our regularly scheduled update function. -}
update : Msg -> Model -> ( Model, Cmd Msg )
update msg model =
ourUpdateFunction
{-|
An Elm update function takes a new message and the existing model and returns a tuple of the new model and
any command(s) to be executed, like above. (Using an alias hopefully makes the type signature below clearer.)
-}
@arsduo
arsduo / simple-elm-program.elm
Created September 24, 2018 00:55
Simple Elm Program
type alias Model =
{ videoPlaying : Bool
, quizState : QuizDataTypeWithQuestionAndAnswerInfo
}
type Msg
= PlayVideo VideoId
| QuizAnswerSelected QuestionId AnswerId
@arsduo
arsduo / event-logging-in-js.js
Created September 24, 2018 00:52
Event Logging in Javascript
playVideo() {
this.videoPlayer.play()
// eventLogger calls out to the server, which adds data about the
// user, their device, their school, etc. etc. etc.
eventLogger.log(“Student started video”, {
videoId: this.videoPlayer.videoId
})
}
selectQuizAnswer(questionId, answerId) {
@arsduo
arsduo / history-export-list-0.19.js
Created September 16, 2018 13:53
Elm 0.19 History Export of a List
{
"$": "::",
"a": {
"title": "Too Like the Lightning"
},
"b": {
"$": "::",
"a": {
"title": "The Fear of Barbarians"
},
@arsduo
arsduo / history-export-history-0.19.js
Created September 16, 2018 13:44
Elm 0.19 History Export (history section)
{
"history": [
{
"$": "Decrement",
"a": 1
},
{
"$": "Increment",
"a": 2
},