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
<?php | |
/** | |
* This code generates an SVG QR code with rounded corners. It uses a round rect for each square and then additional | |
* paths to fill in the gap where squares are next to each other. Adjacent squares overlap - to almost completely | |
* eliminate hairline antialias "cracks" that tend to appear when two SVG paths are exactly adjacent to each other. | |
* | |
* composer require chillerlan/php-qrcode (tested with version 4.2) | |
*/ |
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
// | |
// main.swift | |
// Lint | |
// | |
// Created by Abhi Beckert on 18/6/18. | |
// Copyright © 2018 Abhi Beckert. All rights reserved. | |
// | |
import Foundation |
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
{ | |
number = ( | |
{ | |
MenuLabel = "="; | |
NumberOfArguments = 1; | |
Clause = "= '${}'"; | |
}, | |
{ | |
MenuLabel = "\U2260"; | |
NumberOfArguments = 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
/* example usage in Cocoa Script: | |
// create a window | |
var window = [[NSWindow alloc] init] | |
// create an OK button | |
var okButton = [[NSButton alloc] initWithFrame:NSMakeRect(10, 10, 100, 100)] | |
[okButton setTitle:"Continue"] | |
[okButton sizeToFit] | |
[okButton setKeyEquivalent:"\r"] |
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 "COTarget.h" | |
@implementation COTarget | |
+ (instancetype)targetWithAction:(MOJavaScriptObject *)action | |
{ | |
return [[[self class] alloc] initWithAction:action]; | |
} |
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
// as many inserts as possible before 30 second timeout hits | |
// 226,465 inserts | |
// auto_increment int(11) | |
while (1) { | |
$uuidstr = gen_uuid(); | |
$uuidbin = DB::escape(pack("h*", str_replace('-', '', $uuidstr))); | |
DB::query("insert into test values ()"); | |
} |
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
Option 1: | |
let urlRegex = "(?i)\\b((?:[a-z][\\w-]+:(?:/{1,3}|[a-z0-9%])|www\\d{0,3}[.]|[a-z0-9.\\-]+[.][a-z]{2,4}/)(?:[^\\s()<>]+|\\(([^\\s()<>]+|(\\([^\\s()<>]+\\)))*\\))+(?:\\(([^\\s()<>]+|(\\([^\\s()<>]+\\)))*\\)|[^\\s`!()\\[\\]{};:'\".,<>?«»“”‘’]))" | |
Option 2: | |
let urlRegex = """ | |
(?xi) | |
\b |
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/swift | |
import Foundation | |
print("Content-type: text/html\n\n") | |
// load all data files | |
let dataDir = "/Users/abhi/www/data.json-files" |
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
func updateKeys() | |
{ | |
CATransaction.begin() | |
CATransaction.setDisableActions(true); | |
var x: CGFloat = 0 | |
var y: CGFloat = 0 | |
var rowHeight = ceil(self.inputView.frame.size.height / 5) | |
var colWidth = ceil(self.inputView.frame.size.width / 10) | |
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/swift | |
import Cocoa | |
// remove $0 from args | |
var args = Process.arguments | |
args.removeAtIndex(0) | |
// process input files | |
for arg in args { |
NewerOlder