This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
######################### | |
# .gitignore file for Xcode4 / OS X Source projects | |
# | |
# Version 2.0 | |
# For latest version, see: http://stackoverflow.com/questions/49478/git-ignore-file-for-xcode-projects | |
# | |
# 2013 updates: | |
# - fixed the broken "save personal Schemes" | |
# | |
# NB: if you are storing "built" products, this WILL NOT WORK, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# Deep clean Xcode project. Run from project root directory. | |
if [ -d "build" ]; then | |
/bin/rm -rf "build" | |
fi | |
if [ -d "$HOME/Library/Developer/Xcode/DerivedData" ]; then | |
/bin/rm -rf "$HOME/Library/Developer/Xcode/DerivedData/*" | |
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"Signature validates on www.jwt.io" | |
| dictToSign secret headerD headerJ headerE payloadJ payloadE joined signed signedE | | |
dictToSign := Dictionary new at: 'test' put: 123. | |
secret := 'secret'. | |
"Don't change below" | |
headerD := Dictionary new at: 'alg' put: 'HS256'; at: 'typ' put: 'JWT'; yourself. | |
headerJ := NeoJSONWriter toString: headerD. | |
headerE := ZnBase64Encoder new encode: (ZnUTF8Encoder new encodeString: headerJ) asByteArray. | |
payloadJ := NeoJSONWriter toString: dictToSign. | |
payloadE := ZnBase64Encoder new encode: (ZnUTF8Encoder new encodeString: payloadJ) asByteArray. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// NSNotificationCenter+Token.h | |
// | |
// Created by brackendev | |
// Based on Ole Begemann's article and Swift implementation <https://oleb.net/blog/2018/01/notificationcenter-removeobserver/> | |
// | |
@import Foundation; | |
@class NotificationToken; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# Bootstrap an F# Visual Studio solution on UNIX (with console, library, and test projects) | |
########## Create solution ########## | |
mkdir $1 | |
cd $1 | |
dotnet new sln | |
echo •••••••••• $1 solution created •••••••••• | |
########## Create library project ########## |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"Recursive block example" | |
| limit block | | |
limit := 10. | |
block := [ :count | | |
Transcript crShow: count asString. | |
(count = limit) ifFalse: [ block value: count + 1 ]. | |
]. | |
block value: 1. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"https://rosettacode.org/wiki/Last_Friday_of_each_month" | |
| lastFriday | | |
lastFriday := [ :yr | | firstDay firstFriday | | |
firstDay := Date year: yr month: 1 day: 1. | |
firstFriday := firstDay addDays: (6 - firstDay dayOfWeek). | |
(0 to: 53) | |
collect: [ :each | firstFriday addDays: (each * 7) ] | |
thenSelect: [ :each | | |
(((Date daysInMonth: each monthIndex forYear: yr) - each dayOfMonth) <= 6) and: [ each year = yr ] ] ]. | |
lastFriday value: 2019. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"https://rosettacode.org/wiki/Detect_division_by_zero" | |
| zeroDivide | | |
zeroDivide := [ :aBlock | | |
[ aBlock value. false ] on: ZeroDivide do: [ true ]. | |
]. | |
zeroDivide value: [2/1]. "false" | |
zeroDivide value: [2/0]. "true" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="utf-8"?> | |
<rss version="2.0"> | |
<channel> | |
<title>Example Feed</title> | |
<description>Insert witty or insightful remark here</description> | |
<link>http://example.org/</link> | |
<lastBuildDate>Sat, 13 Dec 2003 18:30:02 GMT</lastBuildDate> | |
<managingEditor>johndoe@example.com (John Doe)</managingEditor> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; Page 120 | |
(defun dot->png (fname thunk) | |
(with-open-file (*standard-output* | |
fname | |
:direction :output | |
:if-exists :supersede) | |
(funcall thunk)) | |
(ccl:run-program "/usr/local/bin/dot" (list "-Tpng" "-O" fname))) |
OlderNewer