Skip to content

Instantly share code, notes, and snippets.

Avatar

Anthonny Quérouil anthonny

View GitHub Profile
View Main.elm
module Main exposing (main)
import Browser
import Html exposing (Html, a, div, form, input, li, text, ul)
import Html.Attributes exposing (class, classList, href, placeholder, style, target, value)
import Html.Events exposing (onClick, onInput, onSubmit)
import Svg
import Svg.Attributes as SvgAttr
View machine.js
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
View snail.js
snail = function(array) {
if (!array || array.length && !array[0].length) {
return [];
}
const start = 0, nbCols = array[0].length, nbRows = array.length;
return parse(array, start, nbCols, 0, nbRows);
}
function parse(array, start, nbCols, row, nbRows) {
@anthonny
anthonny / webpack.config.js
Created Mar 15, 2019
Use dotenv with NativeScript
View webpack.config.js
// ...
const dotenv = require("dotenv");
// ...
console.log(`Bundling application for entryPath ${entryPath}...`);
dotenv.config()
const isUppercase = key => key.toUpperCase() === key;
const envKeys = Object.keys(env);
@anthonny
anthonny / README.adoc
Last active Jan 18, 2019
Atom Rainbow Indent
View README.adoc
@anthonny
anthonny / SparkCopyPostgres.scala
Created Aug 8, 2017 — forked from longcao/SparkCopyPostgres.scala
COPY Spark DataFrame rows to PostgreSQL (via JDBC)
View SparkCopyPostgres.scala
import java.io.InputStream
import org.apache.spark.sql.execution.datasources.jdbc.JdbcUtils
import org.apache.spark.sql.{ DataFrame, Row }
import org.postgresql.copy.CopyManager
import org.postgresql.core.BaseConnection
val jdbcUrl = s"jdbc:postgresql://..." // db credentials elided
val connectionProperties = {
@anthonny
anthonny / README.adoc
Created Aug 27, 2014
Atom - Add line numbers in code block of Asciidoctor-preview
View README.adoc

Run Cmd/Ctrl+Shift+P and type : Open your stylesheet

Then add the content of style.less in that file.

View app.js
mongoose = require('mongoose');
var _ = require('underscore');
var db = mongoose.createConnection('localhost', 'stack-test');
/* Schema definition */
var SellerSchema = new mongoose.Schema({
created: {
type: Date,
default: Date.now
},
You can’t perform that action at this time.