Skip to content

Instantly share code, notes, and snippets.

View JoseGonzalez321's full-sized avatar
💭
GraphQL is interesting

Jose Gonzalez JoseGonzalez321

💭
GraphQL is interesting
View GitHub Profile
@JoseGonzalez321
JoseGonzalez321 / PlaygroundJs.jsx
Created August 18, 2017 20:51
Playing with ReactJS
function Button (props) {
// Returns a DOM element here. For example:
return <button type="submit">{props.label}</button>;
}
function ProfilePic(props) {
return (
<img src={props.url} />
);
}
import React from 'react';
function RobotMaster(props) {
return (
<li>
<img src={props.avatar}/> {props.name} -> {props.weapon}
</li>
)
}
import React, {Component} from 'react';
import logo from './logo.svg';
import './App.css';
import RobotMaster from './robotmaster';
function RobotItem(props) {
return (
<li>
{props.name}
</li>

How to interpolate a multiline string literal

One of my favorite features of C# 6 is string interpolation. It helps move unnecessary string.format(...) noisy code.

String Interpolation

Here's a quick example:

var person = new Person {FirstName = "Jose", LastName = "Gonzalez"};
@JoseGonzalez321
JoseGonzalez321 / Axios.html
Created June 8, 2017 16:05
Playing around with Axios library
<Html>
<head>
</head>
<body>
<script src="https://unpkg.com/axios/dist/axios.min.js"></script>
<script>
// reg JS
<!-- axios('http://megaman-robot-masters.herokuapp.com/') -->
<!-- .then(function (response) { -->
@JoseGonzalez321
JoseGonzalez321 / Check-a-Website-is-Responding.fsx
Created June 8, 2017 15:59
This script checks that a website is responding with a 200 using FSharp
// From
// https://fsharpforfunandprofit.com/posts/low-risk-ways-to-use-fsharp-at-work-2/#dev-website-responding
//This script checks that a website is responding with a 200.
//This might be useful as the basis for a post-deployment smoke test
#r @"..\Packages\FSharp.Data\lib\net40\FSharp.Data.dll"
open FSharp.Data
@JoseGonzalez321
JoseGonzalez321 / RSSFeedIntoCSV.fsx
Created June 8, 2017 15:55
Downloading an RSS feed. Using XML type provider to manipulate and saving results into a CSV file.
//https://fsharpforfunandprofit.com/posts/low-risk-ways-to-use-fsharp-at-work-2/#dev-rss-to-csv
System.IO.Directory.SetCurrentDirectory (__SOURCE_DIRECTORY__)
#r @"..\Packages\FSharp.Data\lib\net40\FSharp.Data.dll"
#r "System.Xml.Linq.dll"
open FSharp.Data
type Rss = XmlProvider<"http://stackoverflow.com/feeds/tag/elm">
@JoseGonzalez321
JoseGonzalez321 / HtmlProvider.fsx
Created June 8, 2017 15:52
Html Provider example. Gets some data from URI and stores in a variable
// You need Fsharp providers. More info at: http://fsharp.github.io/FSharp.Data/
#r @"..\Packages\FSharp.Data\lib\net40\FSharp.Data.dll"
open FSharp.Data
[<Literal>]
let uri = @"https://en.wikipedia.org/wiki/Doctor_Who"
type DoctorWhoData = HtmlProvider<uri>
@JoseGonzalez321
JoseGonzalez321 / index.html
Last active April 11, 2017 20:16
JavaScript: Comparing two dates with month and year only. JS Bin// source http://jsbin.com/lowugaj
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
</head>
<body>
<script id="jsbin-javascript">
#r @"..\Packages\FSharp.Data\lib\net40\FSharp.Data.dll"
open System
open System.IO
open System.Web
open System.Net
open FSharp.Data
type Robot = JsonProvider<"http://megaman-robot-masters.herokuapp.com/">