This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ?. Mixed with the type system | |
let thing: number | undefined | string | { descripcion: string } = 1; | |
console.log(thing?.descripcion); // => test.ts(2,20): error TS2339: Property 'descripcion' does not exist on type 'number'. | |
thing = "test"; | |
console.log(thing?.descripcion); // => test.ts(5,20): error TS2339: Property 'descripcion' does not exist on type 'string'. | |
thing = { descripcion: "test" }; | |
console.log(thing?.descripcion); //=> test.ts(11,20): error TS2339: Property 'descripcion' does not exist on type 'string | number | { descripcion: string; }'. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
port module Main exposing (..) | |
import List | |
import Maybe exposing (withDefault) | |
import Json.Encode as Je | |
type Thing | |
= One | |
| Two Int |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
port module Facebook exposing (..) | |
import Html exposing (..) | |
import Html.Attributes exposing (..) | |
import Html.Events exposing (..) | |
import String | |
import Debug | |
main = |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
port module Spelling exposing (..) | |
import Html exposing (..) | |
import Html.Events exposing (..) | |
import String | |
main = | |
program | |
{ init = init |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
puts "Count with {}" | |
puts [[1,1],[2],[3],[4,3]].count { |elements| !elements.all? { |element| element == elements.first } or elements.size == 1 } | |
puts "----------------------" | |
# Response: | |
# Count with {} | |
# 3 | |
# ---------------------- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rails/commands/server' | |
module Rails | |
class Server | |
def default_options | |
super.merge(Host: '0.0.0.0', Port: 3000) | |
end | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# CSV.parse(csv_header, col_sep: ColSepSniffer.find(csv_header)) | |
# returns a CSV::Table object | |
p CSV.parse(csv_file, | |
headers: true, | |
col_sep: ColSepSniffer.find(csv_headers)).map(&:to_hash) | |
#!/usr/bin/env ruby | |
# encoding: utf-8 | |
require "csv" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Path to your oh-my-zsh installation. | |
export ZSH=$HOME/.oh-my-zsh | |
# Set name of the theme to load. | |
# Look in ~/.oh-my-zsh/themes/ | |
# Optionally, if you set this to "random", it'll load a random theme each | |
# time that oh-my-zsh is loaded. | |
ZSH_THEME="pygmalion" | |
# Uncomment the following line to use case-sensitive completion. |
NewerOlder