Skip to content

Instantly share code, notes, and snippets.

View mauriciofierrom's full-sized avatar
💻
Bit by bit

Mauricio Fierro mauriciofierrom

💻
Bit by bit
View GitHub Profile
@mauriciofierrom
mauriciofierrom / webpack.config.js
Created June 1, 2019 21:51
Webpack configuration
const path = require('path');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const outputDir = path.join(__dirname, 'build/');
const isProd = process.env.NODE_ENV === 'production';
module.exports = {
entry: './src/Index.bs.js',
target: 'electron-main',
mode: isProd ? 'production' : 'development',
@mauriciofierrom
mauriciofierrom / Dnd.re
Created August 26, 2018 04:16 — forked from SllyQ/Dnd.re
open ExtUtils;
module DragDropContext = {
[@bs.module "react-beautiful-dnd"] external reactClass : ReasonReact.reactClass =
"DragDropContext";
Js.log(reactClass);
let make = (~onDragEnd, children) =>
ReasonReact.wrapJsForReason(~reactClass, ~props={"onDragEnd": onDragEnd}, children);
};
@mauriciofierrom
mauriciofierrom / gadts.hs
Created July 4, 2018 01:00
Playing with GADTs and destructuring them.
{-# LANGUAGE StandaloneDeriving #-}
{-# LANGUAGE GADTs #-}
data D a where
M :: D Bool
F :: Int -> D Int
deriving instance Show (D a)
main :: IO ()
@mauriciofierrom
mauriciofierrom / ticksToUTC.hs
Created May 26, 2018 09:19
Convert from .net ticks to UTCTime in Haskell
import Data.Time ( UTCTime(..)
, fromGregorian
, NominalDiffTime(..)
, addUTCTime )
ticksToUtc :: Integer -> UTCTime
ticksToUtc ticks =
let start = UTCTime (fromGregorian 0001 01 01) 0
seconds = realToFrac (ticks `div` 10000000) :: NominalDiffTime
in addUTCTime seconds start
<html>
<body>
<h1>Hello!</h1>
<p>Serving this from gist.github.com</p>
</body>
</html>
@mauriciofierrom
mauriciofierrom / JengaDice.hs
Last active July 16, 2017 01:44
Jenga Throw 'N Go Dice
import System.Random
import Rainbow
import Data.Maybe (fromMaybe)
import qualified Data.Map.Lazy as Map
main :: IO ()
main = do
roll <- getStdRandom (randomR (0,5))
mapM_ putColorText (replicate 4 roll)
input <- getLine
@mauriciofierrom
mauriciofierrom / upload_alfresco.rb
Created February 24, 2015 19:52
Upload files to Alfresco setting Name, Description, Title and Tags using CMIS, REST and Database Access.
#!/usr/bin/env ruby
require 'rest_client'
require 'cmis'
require 'rika'
#require 'pg'
require 'java'
require 'postgresql.jar'
def description_tags(uuid, cur_number, provider, description, value, month, area, tags)
@mauriciofierrom
mauriciofierrom / vimrc
Last active December 21, 2017 16:10
Vim Config
" All system-wide defaults are set in $VIMRUNTIME/debian.vim and sourced by
" the call to :runtime you can find below. If you wish to change any of those
" settings, you should do it in this file (/etc/vim/vimrc), since debian.vim
" will be overwritten everytime an upgrade of the vim packages is performed.
" It is recommended to make changes after sourcing debian.vim since it alters
" the value of the 'compatible' option.
" This line should not be removed as it ensures that various options are
" properly set to work with the Vim-related packages available in Debian.
runtime! debian.vim
@mauriciofierrom
mauriciofierrom / application.js
Created April 3, 2013 21:10
my application.js file
// This is a manifest file that'll be compiled into application.js, which will include all the files
// listed below.
//
// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
// or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path.
//
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
// the compiled file.
//
// WARNING: THE FIRST BLANK LINE MARKS THE END OF WHAT'S TO BE PROCESSED, ANY BLANK LINE SHOULD
@mauriciofierrom
mauriciofierrom / gist:4524522
Created January 13, 2013 15:10
glxinfo output
name of display: :0
display: :0 screen: 0
direct rendering: Yes
server glx vendor string: SGI
server glx version string: 1.4
server glx extensions:
GLX_ARB_multisample, GLX_EXT_import_context, GLX_EXT_texture_from_pixmap,
GLX_EXT_visual_info, GLX_EXT_visual_rating, GLX_MESA_copy_sub_buffer,
GLX_OML_swap_method, GLX_SGI_swap_control, GLX_SGIS_multisample,
GLX_SGIX_fbconfig, GLX_SGIX_pbuffer, GLX_SGIX_visual_select_group,