Skip to content

Instantly share code, notes, and snippets.

import 'dart:convert';
void main() {
var jsonString = '''
[
{
"PortalID": "WZPORP",
"Name": "Smet's Place"
}
]
@joerocca
joerocca / natas15-solution.py
Last active March 16, 2019 06:21
overthewire natas15 multiprocessing solution
import string
import multiprocessing
import urllib.request
import urllib.parse
url = "http://natas15.natas.labs.overthewire.org/index.php"
headers = {
"Authorization": (
"Basic bmF0YXMxNTpBd1dqMHc1Y3Z4clppT05nWjlKNXN0TlZrbXhkazM5Sg=="
),
@joerocca
joerocca / gitCloneRepos.sh
Created September 26, 2018 19:59
Script to clone multiple repositories
#!/bin/bash
for REPO in $(cat repos.txt); do git clone https://github.com/joerocca/$REPO.git; done
//
// WrappingStaticSpacingFlowLayout.swift
// Freetime
//
// Created by Joe Rocca on 12/7/17.
// Copyright © 2017 Ryan Nystrom. All rights reserved.
//
import Foundation
func bubbleSort<T: Comparable>(array: inout Array<T>) {
var swapped: Bool
repeat {
swapped = false
for i in 0..<array.count - 1 {
if (array[i] > array[i+1]) {
swap(&array[i], &array[i+1])
swapped = true
}
}
@joerocca
joerocca / shuffle.swift
Last active April 5, 2017 21:22 — forked from natecook1000/shuffle.swift
Swift 3.1 shuffle / shuffleInPlace
// (c) 2015 Nate Cook, licensed under the MIT license
//
// Fisher-Yates shuffle as protocol extensions
extension Collection {
/// Return a copy of `self` with its elements shuffled
public func shuffle() -> [Generator.Element] {
var list = Array(self)
list.shuffleInPlace()
return list
defmodule TestProject.Repo.Migrations.CreatePost do
use Ecto.Migration
def change do
create table(:posts) do
add :title, :string
add :description, :text
timestamps()
end
let numbers = [54, 82, 34, 62, 24, 74]
let result = numbers.filter{$0 <= 50}.reduce(0, +)
let numbers = [8, 24, 85, 12, 54, 23]
let sorted = numbers.sorted(by: >)
let numbers = [9, 3, 7, 10, 22, 50]
let total = numbers.reduce(4, +)