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
/*: | |
This is a concept re-implementation of the @Binding and @State property wrappers from SwiftUI | |
The only purpose of this code is to implement those wrappers myself | |
just to understand how they work internally and why they are needed, | |
⚠️ This is not supposed to be a reference implementation nor cover all | |
subtleties of the real Binding and State types. | |
The only purpose of this playground is to show how re-implementing | |
them myself has helped me understand the whole thing better |
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
#include <stdio.h> | |
#include <stdlib.h> | |
#include <string.h> | |
char* urlencode(char* originalText) | |
{ | |
// allocate memory for the worst possible case (all characters need to be encoded) | |
char *encodedText = (char *)malloc(sizeof(char)*strlen(originalText)*3+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
<style>pre { background-color: #1a1a1a; border: 0px solid #ccc; padding: 0px; margin-bottom: 0px; } pre code { display: block; color: #a9bcbc; line-height: 1.4em; font-size: 0.95em; white-space: pre; } pre code .keyword { color: #e73289; } pre code .type { color: #8281ca; } pre code .call { color: #348fe5; } pre code .property { color: #21ab9d; } pre code .number { color: #db6f57; } pre code .string { color: #fa641e; } pre code .comment { color: #6b8a94; } pre code .dotAccess { color: #92b300; } .box { padding: 20px; margin: 0 auto; display: block; border-radius: 8px; background-color: #1a1a1a; border: 0px solid #ccc; } </style> | |
<!--Generate code at: https://splash.rambo.codes/ and then COPY HTML--> | |
<section class="box"><pre><code><!--Paste the generated code after this--><!--Paste the generated code before this--></code></pre></section> |
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
#user nobody; | |
worker_processes 4; | |
#error_log logs/error.log; | |
#error_log logs/error.log notice; | |
#error_log logs/error.log info; | |
#pid logs/nginx.pid; |
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
import FluentSQLite | |
import Vapor | |
/// A single entry of a Issue list. | |
final class Issue: SQLiteModel { | |
/// The unique identifier for this `Issue`. | |
var id: Int? | |
var title: String | |
var description: String |
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
function getCache(name) { | |
return new Promise((resolve, reject) => { | |
const version = 1; | |
const request = indexedDB.open(name, version); | |
request.onsuccess = event => { | |
const db = event.target.result; | |
/* | |
* Returns a Promise that resolves with an object |
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
import UIKit | |
final class CustomIntensityVisualEffectView: UIVisualEffectView { | |
/// Create visual effect view with given effect and its intensity | |
/// | |
/// - Parameters: | |
/// - effect: visual effect, eg UIBlurEffect(style: .dark) | |
/// - intensity: custom intensity from 0.0 (no effect) to 1.0 (full effect) using linear scale | |
init(effect: UIVisualEffect, intensity: CGFloat) { | |
theEffect = effect |
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
/** | |
* Module dependencies. | |
*/ | |
var browserSync = require('browser-sync').create() | |
var proxy = require('http-proxy-middleware') // require('http-proxy-middleware'); | |
/** | |
* Configure proxy middleware | |
*/ | |
var jsonPlaceholderProxy = proxy('/api', { |
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/env ruby | |
require 'xcodeproj' | |
project_path = ARGV[0] | |
project = Xcodeproj::Project.open(project_path) | |
project.targets.each do |target| | |
# suppress warnings | |
if [ | |
"Configs", |
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
import UIKit | |
import SnapKit | |
class ViewController: UIViewController { | |
var scrollView: UIScrollView! | |
var stackView: UIStackView! | |
override func viewDidLoad() { | |
super.viewDidLoad() | |
NewerOlder