View BlogCaptureXcodePlayground.swift
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
/** | |
* **Step 3**: Render all the frames | |
* | |
* This is the accompayning code of a blog post. Read more at https://eschmann.dev | |
*/ | |
import SwiftUI | |
import PlaygroundSupport | |
struct MyExperimentalView: View { |
View AngularGradient.swift
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
//: A SwiftUI based playground. | |
import SwiftUI | |
import PlaygroundSupport | |
struct MyShape : Shape { | |
var startAngle: Double | |
var progress: Double | |
func path(in rect: CGRect) -> Path { |
View Code.gs
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
/** | |
* Counts cell values in a range if they have the given background color | |
* =countByColor("V16", "S12:W20") | |
* | |
* @param {String} Cell reference for color to compare as String. | |
* @param {String} Range to iterate through as String. | |
* @return {int} Count of all cells matching background color. | |
*/ | |
function countByColor(cellColorToCompare, rangeToCount) { | |
var sheet = SpreadsheetApp.getActiveSpreadsheet(); |
View exif.sh
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/bash | |
# Whatsapp 'WhatsApp Image 2020-08-13 at 21.06.23.jpeg' | |
for file in ./*.jpeg; do | |
echo " > $file" | |
year=${file:17:4} | |
month=${file:22:2} | |
day=${file:25:2} | |
hour=${file:31:2} | |
minute=${file:34:2} |
View index.twig
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://twitter.com/dunglas/status/1054993007332724738?s=03 | |
Inject the data encoded in JSON in a `<script type="application/json">` tag. | |
Then access to this element in JS and call `JSON.parse`. | |
It's secure, elegant and works even with the strictest CSPs. | |
https://github.com/api-platform/core/blob/master/src/Bridge/Symfony/Bundle/Resources/views/SwaggerUi/index.html.twig#L11-L12 | |
https://github.com/api-platform/core/blob/master/src/Bridge/Symfony/Bundle/Resources/public/init-swagger-ui.js#L6 | |
#} |
View patch-edid.rb
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
#!/usr/bin/ruby | |
# Create display override file to force Mac OS X to use RGB mode for Display | |
# see http://embdev.net/topic/284710 | |
require 'base64' | |
data=`ioreg -l -d0 -w 0 -r -c AppleDisplay` | |
edids=data.scan(/IODisplayEDID.*?<([a-z0-9]+)>/i).flatten | |
vendorids=data.scan(/DisplayVendorID.*?([0-9]+)/i).flatten |
View import.sh
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
# shorthand | |
mysql -u root <database_name> < <sql_file_path> | |
# long | |
mysql -u root -p | |
use <database_name> | |
source <sql_file_path> | |
# windows phpmyadmin alias | |
importmysql=C:\xampp\mysql\bin\mysql.exe -u root $1 < $2 |
View queries.sql
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
-- Average length of a text column | |
SELECT AVG(LENGTH(content)) AS length FROM `column` WHERE content!=''; | |
-- Maximum length of a text column | |
SELECT MAX(LENGTH(content)) AS length FROM `column` WHERE content!=''; |