Skip to content

Instantly share code, notes, and snippets.

View GabiGrin's full-sized avatar
Building Flyde - https://www.flyde.dev

Gabriel Grinberg GabiGrin

Building Flyde - https://www.flyde.dev
View GitHub Profile
@johanneslumpe
johanneslumpe / gist:3cdb000b5f2816a70041c1306edc97f4
Created May 10, 2016 07:57
Selecting a consecutive entity range in draft-js
const maybeSelectConsecutiveEntity = editorState => {
const selection = editorState.getSelection();
if (!selection.isCollapsed()) {
return editorState;
}
const startKey = selection.getStartKey();
const startOffset = selection.getStartOffset();
const prevOffset = startOffset - 1;
@turboMaCk
turboMaCk / .nvmrc
Last active September 16, 2017 15:21
Elm-test with gulp
5.5.0
@esironal
esironal / codemirror-cdn.html
Last active May 10, 2024 23:07
Codemirror CDN
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Code Mirror CDN</title>
<link rel="stylesheet" href="http://esironal.github.io/cmtouch/lib/codemirror.css">
@DarrenN
DarrenN / get-npm-package-version
Last active June 16, 2024 05:49 — forked from yvele/get-npm-package-version.sh
Extract version from package.json (NPM) using bash / shell
# Version key/value should be on his own line
PACKAGE_VERSION=$(cat package.json \
| grep version \
| head -1 \
| awk -F: '{ print $2 }' \
| sed 's/[",]//g')
echo $PACKAGE_VERSION
@mgold
mgold / using_mailboxes_in_elm.md
Last active March 24, 2020 16:05
Using Mailboxes in Elm: a tutorial blog post

Using Mailboxes in Elm

Max Goldstein | July 30, 2015 | Elm 0.15.1

In Elm, signals always have a data source associated with them. Window.dimensions is exactly what you think it is, and you can't send your own events on it. You can derive your own signals from these primitives using map, filter, and merge, but the timing of events is beyond your control.

This becomes a problem when you try to add UI elements. We want to be able to add checkboxes and dropdown menus, and to receive the current state of these elements as a signal. So how do we do that?

The Bad Old Days

@domenic
domenic / 0-github-actions.md
Last active May 26, 2024 07:43
Auto-deploying built products to gh-pages with Travis

Auto-deploying built products to gh-pages with GitHub Actions

This is a set up for projects which want to check in only their source files, but have their gh-pages branch automatically updated with some compiled output every time they push.

A file below this one contains the steps for doing this with Travis CI. However, these days I recommend GitHub Actions, for the following reasons:

  • It is much easier and requires less steps, because you are already authenticated with GitHub, so you don't need to share secret keys across services like you do when coordinate Travis CI and GitHub.
  • It is free, with no quotas.
  • Anecdotally, builds are much faster with GitHub Actions than with Travis CI, especially in terms of time spent waiting for a builder.
@yyx990803
yyx990803 / async.js
Created August 8, 2014 19:03
Simple helper for async tests in Jasmine 1.3 that mimics 2.0 and Mocha
/**
* Jasmine 1.3 async helper
*/
function async (run) {
return function () {
var done = false
waitsFor(function () { return done })
run(function () { done = true })
}
@butaji
butaji / server.hs
Created May 29, 2011 20:27
Simple Haskell web server
import Control.Monad
import Data.Char
import System.IO
import Network
import Data.Time.LocalTime
data RequestType = GET | POST deriving (Show)
data Request = Request { rtype :: RequestType, path :: String, options :: [(String,String)] }
data Response = Response { version :: String, statuscode :: Int }