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
# 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
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
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
# $Id: screen-keys.conf,v 1.7 2010/07/31 11:39:13 nicm Exp $ | |
# | |
# By Nicholas Marriott. Public domain. | |
# | |
# This configuration file binds many of the common GNU screen key bindings to | |
# appropriate tmux key bindings. Note that for some key bindings there is no | |
# tmux analogue and also that this set omits binding some commands available in | |
# tmux but not in screen. | |
# | |
# Note this is only a selection of key bindings and they are in addition to the |
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 |
NewerOlder