Skip to content

Instantly share code, notes, and snippets.

View bmitch's full-sized avatar

Bill Mitchell bmitch

  • Vancouver Island, BC, Canada
View GitHub Profile
import json
import os
json_data = open("top5.json").read()
data = json.loads(json_data)
data = data["feed"]
data = data['data']
print data[1]['link']
import json
import os
json_data = open("top5.json").read()
data = json.loads(json_data)
data = data["feed"]
data = data['data']
print data[1]['link']

LARAVEL TIPS

Call Artisan Command from Controller, Repository or any other place in your App

<?php

/**
 * @author  Exadra37    <exadra37atgmailpointcom>
 * @since   2014/07/02
 */
0 - Weather Victoria - 162.400
1 - CVARS Repeater - 146.680
2 - CVARS Repeater - 145.470
3 - CVARS Repeater - 442.600
10 - Shawnigan RCMP - 142.425
11 - Shawnigan RCMP - 141.1500
12 - Shawnigan RCMP - 141.180
13 - Shawnigan RCMP - 141.210
14 - Shawnigan RCMP - 141.300
15 - Shawnigan RCMP - 414.310
@bmitch
bmitch / scraper.go
Created June 2, 2016 21:39
Scraper
package main
import (
"fmt"
"golang.org/x/net/html"
"net/http"
"os"
"strings"
)
@bmitch
bmitch / scraper.go
Created June 7, 2016 22:09
weather scraper
package main
import (
"fmt"
"github.com/PuerkitoBio/goquery"
"log"
"strings"
)
@bmitch
bmitch / elixir-pattern-matching.md
Last active February 13, 2023 11:24
elixir-pattern-matching.md

Back

Pattern Matching

  • = is not assignment in Elixir. More like an assertion.
  • Succeeds if it can find a way of making left side equal to right side.
a = 1 #1
a + 3 #1

In thise cases the lef side is a variable and right side is an integer literal. So to make the match it binds the variable to the integer.

@bmitch
bmitch / elixir.md
Last active August 31, 2019 05:14
elixir.md
@bmitch
bmitch / elixir-immutability.md
Last active June 17, 2017 18:38
elixir-immutability.md

Back

Immutability

  • Once a variable a list such as [1, 2 ,3] you know it will always reference those same variables (until you rebind the variable).
  • What if you need to add 100 to each element in [1, 2, 3]? Elixir produces a copy of the original, containing the new values.

This uses the [ head | tail ] operator to build a new list with head as the first element and tail as the rest:

list1 = [3, 2, 1]
@bmitch
bmitch / elixir-basics.md
Last active June 17, 2017 19:05
elixir-basics.md

Back

Basics

Value Types

Represent numbers, names, ranges and regular expressions.

Integers

Can be written as:

  • decimal (1234).