Skip to content

Instantly share code, notes, and snippets.

View tmspzz's full-sized avatar

Tommaso Piazza tmspzz

View GitHub Profile
@shirakaba
shirakaba / README.md
Last active November 17, 2023 00:52
GUI-based debugging of iOS/macOS Rust projects in Xcode

Here's how to get your environment set up to:

  1. Develop iOS and Android apps using Rust.
  2. Enable GUI debugging of Rust projects in Xcode.

If you just want to enable GUI debugging of macOS Rust projects in Xcode, I'm not actually sure whether you need cargo-mobile at all. But one benefit of installing it is that it automatically installs rust-xcode-plugin for you, giving you syntax highlighting of Rust sources in Xcode.

Prerequisites

cargo-mobile

@jaspervdj
jaspervdj / readprec.hs
Created December 6, 2019 11:56
Parser for readPrec
-- Quick example of how to "properly" use readPrec with a "real" parser
import Data.Char (isDigit, toUpper)
import qualified Text.ParserCombinators.ReadP as P
import qualified Text.Read as R
data WirePath = WirePath {d :: Char, a :: Int} deriving (Show)
instance R.Read WirePath where
readPrec = R.readP_to_Prec $ const $ do
c <- P.get
@bessarabov
bessarabov / gist:674ea13c77fc8128f24b5e3f53b7f094
Last active March 27, 2024 07:46
One-liner to generate data shown in post 'At what time of day does famous programmers work?' — https://ivan.bessarabov.com/blog/famous-programmers-work-time
git log --author="Linus Torvalds" --date=iso | perl -nalE 'if (/^Date:\s+[\d-]{10}\s(\d{2})/) { say $1+0 }' | sort | uniq -c|perl -MList::Util=max -nalE '$h{$F[1]} = $F[0]; }{ $m = max values %h; foreach (0..23) { $h{$_} = 0 if not exists $h{$_} } foreach (sort {$a <=> $b } keys %h) { say sprintf "%02d - %4d %s", $_, $h{$_}, "*"x ($h{$_} / $m * 50); }'
@AhsanAyaz
AhsanAyaz / angular-travis-ci.yml
Last active January 3, 2020 00:20
Sample TravisCI Yaml file for Angular Project
language: node_js
node_js:
- "7"
sudo: true
dist: trusty
branches:
only:
- master
@mmorris
mmorris / wwdc_2012_urls.txt
Created July 7, 2016 13:41
WWDC 2012 HD video URL list
https://developer.apple.com/devcenter/download.action?path=/videos/wwdc_2012__hd/session_307__building_great_newsstand_apps.mov
https://developer.apple.com/devcenter/download.action?path=/videos/wwdc_2012__hd/session_311__building_and_distributing_custom_b2b_apps_for_ios.mov
https://developer.apple.com/devcenter/download.action?path=/videos/wwdc_2012__hd/session_304__events_and_reminders_in_event_kit.mov
https://developer.apple.com/devcenter/download.action?path=/videos/wwdc_2012__hd/session_300__getting_around_using_map_kit.mov
https://developer.apple.com/devcenter/download.action?path=/videos/wwdc_2012__hd/session_306__integrating_with_facebook_twitter_and_sina_weibo.mov
https://developer.apple.com/devcenter/download.action?path=/videos/wwdc_2012__hd/session_301__introducing_passbook_part_1.mov
https://developer.apple.com/devcenter/download.action?path=/videos/wwdc_2012__hd/session_309__introducing_passbook_part_2.mov
https://developer.apple.com/devcenter/download.action?path=/videos/wwdc_2012__hd/session_3
@rsattar
rsattar / LKImageView.m
Last active January 22, 2016 23:11
UIImageView which constraints its own height based on its layouted width
- (void) setImage:(UIImage *)image
{
[super setImage:image];
if (self.lk_heightConstrainedToAspectWidth && self.image) {
CGFloat imageAspectRatio = self.image.size.height / self.image.size.width;
// If we haven't constrained ourself, or the constraint needs updating
if (!self.aspectRatioHeightConstraint || self.aspectRatioHeightConstraint.multiplier != imageAspectRatio) {
[self setNeedsUpdateConstraints];
}
@JadenGeller
JadenGeller / AttributedStringBuilder.swift
Last active March 26, 2022 03:24
Interpolated Attributed String Builder
// Example
var brown: AttributedStringSegment = "brown"
brown.foregroundColor = UIColor.brownColor()
brown.expansion = 1.1
var lazy: AttributedStringSegment = "lazy"
lazy.strikethroughStyle = NSUnderlineStyle.StyleDouble
lazy.strikethroughColor = UIColor.redColor()
@JaviLorbada
JaviLorbada / FRP iOS Learning resources.md
Last active June 17, 2024 06:08
The best FRP iOS resources.

Videos

# Hello, and welcome to makefile basics.
#
# You will learn why `make` is so great, and why, despite its "weird" syntax,
# it is actually a highly expressive, efficient, and powerful way to build
# programs.
#
# Once you're done here, go to
# http://www.gnu.org/software/make/manual/make.html
# to learn SOOOO much more.
@staltz
staltz / introrx.md
Last active July 6, 2024 08:47
The introduction to Reactive Programming you've been missing