Skip to content

Instantly share code, notes, and snippets.

View AgtLucas's full-sized avatar
🌎
💀⏳🌷

Lucas AgtLucas

🌎
💀⏳🌷
View GitHub Profile
@AgtLucas
AgtLucas / grab-the-city.swift
Last active September 17, 2019 12:40 — forked from TheAlienMann/Grab The City
"Grab The City" is a challenge that wants you to extract the name of the city in a given sentence which the name is wrapped in a pair of square brackets in the end of the sentence.
func grabCity(_ str: String) -> String {
// the commented line below (the regex to be exact) gets just the last word! which is wrong, my fault though, i didn't read the challenge corectly!
// let regex = try! NSRegularExpression(pattern: "(\\w+)(?!.*\\w)", options: [])
// the regex below get every matches in the sentence that is being wrapped in a pair of square brackets.
let regex = try! NSRegularExpression(pattern: "(?<=\\[)(.+?)(?=\\])", options: [])
// the "result" below is of type NSTextCheckingResult which is an array, since the challenge askes for the last match, and i couldn't get the last match through the regex, i ened up gtting the last match via the "last" item in the array.
let result = regex.matches(in: str, options: [], range: NSRange(location: 0, length: str.count)).last
/*
// from line 11 to 18, is an alternative for getting the matches out of the result array, since it is an array (of type NSTextCheckingResult) you can iterate thtough it (loop though it)
// you can use each o
@AgtLucas
AgtLucas / 1.md
Created July 6, 2019 11:52 — forked from swyxio/1.md
Learn In Public - 7 opinions for your tech career

1. Learn in public

this essay has been updated on my personal site, together with a followup on how to get started

If there's a golden rule, it's this one, so I put it first. All the other rules are more or less elaborations of this rule #1.

You already know that you will never be done learning. But most people "learn in private", and lurk. They consume content without creating any themselves. Again, that's fine, but we're here to talk about being in the top quintile. What you do here is to have a habit of creating learning exhaust. Write blogs and tutorials and cheatsheets. Speak at meetups and conferences. Ask and answer things on Stackoverflow or Reddit. (Avoid the walled gardens like Slack and Discourse, they're not public). Make Youtube videos or Twitch streams. Start a newsletter. Draw cartoons (people loooove cartoons!). Whatever your thing is, make the thing you wish you had found when you were learni

//
// ContentView.swift
// BreatheUI WatchKit Extension
//
// Created by Joel Bernstein on 6/24/19.
// Copyright © 2019 Joel Bernstein. All rights reserved.
//
import SwiftUI
#! /usr/bin/env bash
# Requirements:
# - `primitive` @ https://github.com/fogleman/primitive,
# - `imagemagick` @ http://www.imagemagick.org/script/index.php,
# - `ffmpeg` @ https://ffmpeg.org/
# Make sure your input photo is named `input.jpg` (variable support later!)
# keep yo folder neat
<!DOCTYPE html>
<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<style>
body {
background: repeat url('data:image/jpeg;base64,/9j/4AAQSkZJRgABAQEASABIAAD/7QCIUGhvdG9zaG9wIDMuMAA4QklNBAQAAAAAAGscAVoAAxslRxwCAAACAAAcAnQAV8KpIENoYWV5b3VuZ1dpbGxOZXZlckNoYWVvbGQgLSBodHRwOi8vd3d3LnJlZGJ1YmJsZS5jb20vcGVvcGxlL0NoYWV5b3VuZ1dpbGxOZXZlckNoYWVvbAD/4gxYSUNDX1BST0ZJTEUAAQEAAAxITGlubwIQAABtbnRyUkdCIFhZWiAHzgACAAkABgAxAABhY3NwTVNGVAAAAABJRUMgc1JHQgAAAAAAAAAAAAAAAAAA9tYAAQAAAADTLUhQICAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABFjcHJ0AAABUAAAADNkZXNjAAABhAAAAGx3dHB0AAAB8AAAABRia3B0AAACBAAAABRyWFlaAAACGAAAABRnWFlaAAACLAAAABRiWFlaAAACQAAAABRkbW5kAAACVAAAAHBkbWRkAAACxAAAAIh2dWVkAAADTAAAAIZ2aWV3AAAD1AAAACRsdW1pAAAD+AAAABRtZWFzAAAEDAAAACR0ZWNoAAAEMAAAAAxyVFJDAAAEPAAACAxnVFJDAAAEPAAACAxiVFJDAAAEPAAACAx0ZXh0AAAAAENvcHlyaWdodCAoYykgMTk5OCBIZXdsZXR0LVBhY2thcmQgQ29tcGFueQAAZGVzYwAAAAAAAAASc1JHQiBJRUM2MTk2Ni0yLjEAAAAAAAAAAAAAABJzUkdCIElFQzYxOTY2LTIuMQAAAAAAAA

A Redux Story

Developer: "Doo Doo Doo... Working on the new Redux rewrite. Gotta write some fetch actions..."

FETCH_USERS -> function fetchUsersAction() {...}
FETCH_PAGES -> function fetchPagesAction() {...}
FETCH_FRIENDS -> function fetchFriendsAction() {...}
FETCH_GROUPS -> function fetchGroupsAction() {...}
FETCH_EVENTS -> function fetchEventsAction() {...}
@AgtLucas
AgtLucas / music.md
Created May 20, 2018 14:09 — forked from staltz/music.md
coding music

Not for everyone. Each programmer has their own appreciation of what is good coding music.

For when I need to think deep, debug something, or design

(From most influential to least)

@AgtLucas
AgtLucas / prepack-gentle-intro-1.md
Created May 9, 2018 06:48 — forked from gaearon/prepack-gentle-intro-1.md
A Gentle Introduction to Prepack, Part 1

Note:

When this guide is more complete, the plan is to move it into Prepack documentation.
For now I put it out as a gist to gather initial feedback.

A Gentle Introduction to Prepack (Part 1)

If you're building JavaScript apps, you might already be familiar with some tools that compile JavaScript code to equivalent JavaScript code:

  • Babel lets you use newer JavaScript language features, and outputs equivalent code that targets older JavaScript engines.
let str = ReasonReact.string;
let url = "http://localhost:3000/users";
type user = {
id: int,
name: string,
};
type state =
@AgtLucas
AgtLucas / facebook-contact-info-summary.rb
Created March 22, 2018 20:59 — forked from dylanmckay/facebook-contact-info-summary.rb
A Ruby script for collecting phone record statistics from a Facebook user data dump
#! /usr/bin/env ruby
# This script can be used to parse and dump the information from
# the 'html/contact_info.htm' file in a Facebook user data ZIP download.
#
# It dumps all cell phone call + SMS message + MMS records, plus a summary of each.
#
# Place this script inside the extracted Facebook data download folder
# alongside the 'html' folder.
#