Skip to content

Instantly share code, notes, and snippets.

View anthonny's full-sized avatar
🏠
Working from home

Anthonny Quérouil anthonny

🏠
Working from home
View GitHub Profile
@anthonny
anthonny / Main.elm
Last active June 16, 2020 22:56
Todo App
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
@anthonny
anthonny / machine.js
Created March 10, 2020 11:27
Generated by XState Viz: https://xstate.js.org/viz
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
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 March 15, 2019 14:38
Use dotenv with NativeScript
// ...
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 December 18, 2022 02:26
Atom Rainbow Indent
@anthonny
anthonny / SparkCopyPostgres.scala
Created August 8, 2017 07:03 — forked from longcao/SparkCopyPostgres.scala
COPY Spark DataFrame rows to PostgreSQL (via JDBC)
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 = {
Sync for atom
@anthonny
anthonny / README.adoc
Created August 27, 2014 06:13
Atom - Add line numbers in code block of Asciidoctor-preview

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

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

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
},