Skip to content

Instantly share code, notes, and snippets.

@glinesbdev
glinesbdev / Main.elm
Last active May 1, 2019
Cmd.batch Example
View Main.elm
type Msg
= UrlRequested Browser.UrlRequest
| UrlChanged Url.Url
| NameEntered String
| NameSubmitted
| MessageEntered String
| MessageSubmitted
| GenerateRandomId String
generateRandomChatId : Cmd Msg
View Css.Elm
gridItem :
GridItem
-> (List (Attribute msg) -> List (Html msg) -> Html msg)
-> List (Attribute msg)
-> List (Html msg)
-> Html msg
gridItem item html attributes children =
html (gridItemAttributes item ++ attributes) children
@glinesbdev
glinesbdev / Main.elm
Created Apr 25, 2019
Elm Type vs Type Alias
View Main.elm
type alias Grid =
{ gridTemplateColumns : Maybe GridTemplateColumns
, gridTemplateRows : Maybe GridTemplateRows
, gridTemplateArea : Maybe GridTemplateArea
, gridTemplate : Maybe GridTemplate
}
type Grid
= GridTemplateColumn (Maybe String)
@glinesbdev
glinesbdev / Main.elm
Created Apr 25, 2019
Elm String of Strings
View Main.elm
module Main exposing (main)
import Browser
import Html exposing (Html, button, div, text)
import Html.Events exposing (onClick)
type alias Model =
String
@glinesbdev
glinesbdev / Problem.cs
Last active Mar 17, 2019
C# Generic Where
View Problem.cs
// Classes included for clarity
public class MovieList
{
IEnumerable<IMovie> Movies { get; set; }
}
public class Api<T> where T : IMovie
{
public IEnumerable<T> GetMovies()
@glinesbdev
glinesbdev / reads_controller.dart
Created Feb 22, 2019
(Dart 2) Basic Aqueduct HTTP Controller
View reads_controller.dart
/// This is a very basic HTTP Controller for the Aqueduct Dart web framework
/// [https://aqueduct.io/]
import 'dart:async';
import 'dart:io';
import 'package:aqueduct/aqueduct.dart';
import 'package:faker/faker.dart';
const Faker faker = Faker();
@glinesbdev
glinesbdev / Main.hs
Last active Jul 2, 2018
Haskell - Read JSON and parse data
View Main.hs
{-# LANGUAGE
OverloadedStrings
, DeriveGeneric
#-}
module Lib where
import Prelude as P
import Data.Aeson
import Data.Text
@glinesbdev
glinesbdev / database.php
Last active Oct 4, 2017
PHP database class [IN PROGRESS]
View database.php
<?php declare(strict_types = 1);
namespace CMS\Data;
include_once(__DIR__ . '/../helpers/array.php');
/**
* Database class that handles all database connections and related actions.
*
* @param $user The connecting user
* @param $pass Password for the $user
@glinesbdev
glinesbdev / adminController.js
Created May 12, 2017
Basic Node / Express API
View adminController.js
var adminRouter = require('../config/routers')().adminRouter;
var Book = require('../data/models/bookModel');
var db = require('../data/db')();
var adminController = function() {
var books = [
{
title: 'War and Peace',
author: 'Lev Nikolayevich Tolstoy',
genre: 'Historical Fiction',
@glinesbdev
glinesbdev / index.html
Created May 3, 2017
Longest word in string (immutable.js)
View index.html
<!doctype html>
<html>
<head>
<title>Immutable</title>
</head>
<body>
<script src="https://cdnjs.cloudflare.com/ajax/libs/immutable/3.8.1/immutable.min.js"></script>
<script>
const lyrics = "Another dream that will never come true Just to compliment your sorrow Another life that I've taken from you A gift to add on to your pain and suffering Another truth you can never believe Has crippled you completely All the cries you're beginning to hear Trapped in your mind, and the sound is deafening Let me enlighten you This is the way I pray Living just isn't hard enough Burn me alive, inside Living my life's not hard enough Take everything away Another nightmare about to come true Will manifest tomorrow Another love that I've taken from you Lost in time, on the edge of suffering Another taste of the evil I breed Will level you completely Bring to life everything that you fear Live in the dark, and the world is threatening Let me enlighten you This is the way i pray Liv
You can’t perform that action at this time.