Skip to content

Instantly share code, notes, and snippets.

View MihaelIsaev's full-sized avatar
🎸
working on Swift for Web

Mikhail Isaev aka iMike MihaelIsaev

🎸
working on Swift for Web
View GitHub Profile
@AliSoftware
AliSoftware / Bindings.swift
Last active May 4, 2024 06:18
Re-implementation of @binding and @State (from SwiftUI) myself to better understand it
/*:
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
@jesobreira
jesobreira / url-encode.c
Created January 22, 2019 21:21 — forked from sudar/url-encode.c
URL Encoding in C (urlencode / encodeURIComponent)
#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);
@kristofk
kristofk / swiftCode.html
Last active December 2, 2022 13:54
Html code that can be used to put highlighted Swift code into a Custom HTML Gutenberg block in Wordpress
<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>
@CSRaghunandan
CSRaghunandan / nginx.conf
Last active April 20, 2024 19:47
Nginx configuration for serving mp4 videos
#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;
@theseanything
theseanything / Issue.swift
Created May 4, 2018 19:51
Custom decoder for Vapor Model
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
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
@darrarski
darrarski / CustomIntensityVisualEffectView.swift
Last active April 23, 2024 08:32
UIVisualEffectView subclass that allows to customise effect intensity
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
@mygoare
mygoare / proxy.js
Created November 11, 2017 03:38
http-proxy-middleware use with browser-sync gulp
/**
* 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', {
@siemensikkema
siemensikkema / fixcodeproj.rb
Last active April 15, 2021 14:06
Post processing script for generated vapor Xcode project
#!/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",
import UIKit
import SnapKit
class ViewController: UIViewController {
var scrollView: UIScrollView!
var stackView: UIStackView!
override func viewDidLoad() {
super.viewDidLoad()