Skip to content

Instantly share code, notes, and snippets.

View StevenXL's full-sized avatar
🙈
WFH

Steven Leiva StevenXL

🙈
WFH
View GitHub Profile
@StevenXL
StevenXL / init.vim
Created October 13, 2023 14:36
nvim
" Path: ~/.confi/nvim/init.vim
set runtimepath^=~/.vim runtimepath+=~/.vim/after
let &packpath = &runtimepath
source ~/.vimrc
@StevenXL
StevenXL / deps.txt
Created April 19, 2022 00:51
stack ls dependencies
Cabal 3.4.1.0
Diff 0.4.1
Glob 0.10.2
HUnit 1.6.2.0
MonadRandom 0.5.3
OneTuple 0.3.1
Only 0.1
QuickCheck 2.14.2
RSA 2.4.1
SHA 1.6.4.4
@StevenXL
StevenXL / maybe.elm
Created April 8, 2020 02:58
Elm - Simulating Maybe.map6
Maybe.map5
(\year month day hour minute ->
{ year = year
, month = month
, day = day
, hour = hour
, minute = minute
, second = 0
}
)
@StevenXL
StevenXL / binarySearchFirstAndLast.js
Created February 10, 2020 03:57
Modified Binary Search
function binarySearch(arr, k, searchType) {
let left = 0;
let right = arr.length - 1;
let ans = null;
while (left <= right) {
const midIdx = Math.floor((left + right) / 2);
const el = arr[midIdx];
@StevenXL
StevenXL / HelloSpec.hs
Last active November 11, 2019 18:10
Example integration of `hspec` and `persistent-sqlite`
#!/usr/bin/env stack
-- stack --resolver lts-11.6 script
{-# LANGUAGE EmptyDataDecls #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE GADTs #-}
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE QuasiQuotes #-}
@StevenXL
StevenXL / web-fonts-asset-pipeline.md
Created August 13, 2019 02:52 — forked from anotheruiguy/web-fonts-asset-pipeline.md
Custom Web Fonts and the Rails Asset Pipeline

Web fonts are pretty much all the rage. Using a CDN for font libraries, like TypeKit or Google Fonts, will be a great solution for many projects. For others, this is not an option. Especially when you are creating a custom icon library for your project.

Rails and the asset pipeline are great tools, but Rails has yet to get caught up in the custom web font craze.

As with all things Rails, there is more then one way to skin this cat. There is the recommended way, and then there are the other ways.

The recommended way

Here I will show how to update your Rails project so that you can use the asset pipeline appropriately and resource your files using the common Rails convention.

@StevenXL
StevenXL / BespokeMonad.hs
Created May 4, 2019 16:05
Bespoke Monad
{-# LANGUAGE InstanceSigs #-}
module Effects.BespokeMonad where
-- Log the value of the accumulator.
-- Pick an integer uniformly randomly from the half-open interval [0, 10).
-- Mutate the accumulator by adding the random integer to it.
-- We need an abstract data type
-- We need an execution fuction
-- We need helper functions
- aeson
- aeson-casing
- aeson-iproute
- aeson-pretty
- aeson-typescript
- amazonka
- amazonka-core
- amazonka-s3
- amazonka-sqs
- async
@StevenXL
StevenXL / yesod_haskell.md
Created April 12, 2019 21:52
Yesod Haskell

Heroku Deployment

This tutorial will go over the steps needed in order to get a Yesod application deployed to Heroku, connecting to a database, and ensuring all requests are forced to use the SSL protocol.

We are going to assume two things in this tutorial:

  1. You have used Heroku before to deploy web applications.
  2. You have a Yesod application created with the yesod-postgres template.