Skip to content

Instantly share code, notes, and snippets.

View crarau's full-sized avatar

Ciprian (Chip) Rarau crarau

  • wisk.ai
  • Canada
View GitHub Profile
@exAspArk
exAspArk / curl.sh
Last active May 28, 2024 06:43
Test CORS with cURL
curl -I -X OPTIONS \
-H "Origin: http://EXAMPLE.COM" \
-H 'Access-Control-Request-Method: GET' \
http://EXAMPLE.COM/SOMETHING 2>&1 | grep 'Access-Control-Allow-Origin'
@ericdke
ericdke / splitBy.swift
Last active July 10, 2023 09:55
Swift: split array by chunks of given size
let arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]
extension Array {
func splitBy(subSize: Int) -> [[Element]] {
return 0.stride(to: self.count, by: subSize).map { startIndex in
let endIndex = startIndex.advancedBy(subSize, limit: self.count)
return Array(self[startIndex ..< endIndex])
}
}
}
the HTML
<head>
<script type="text/javascript">
var MTUserId='xyz'; // made xyz instead of actual string
var MTFontIds = new Array();
MTFontIds.push("abc"); // made abc instead of id of the fonts
MTFontIds.push("def"); // made def instead of id of the fonts
(function() {
@shanesmith
shanesmith / fix-xcodeproj.rb
Created August 14, 2014 15:54
Fix a Cordova-generated xcodproj not having any schemes defined
#!/usr/bin/env ruby
require 'xcodeproj'
path = ARGV.shift
xcproj = Xcodeproj::Project.open(path)
# Fix schemes not being defined
xcproj.recreate_user_schemes
@phildow
phildow / CLLocation+EXIFGPS.h
Last active December 2, 2019 02:37
Category to create GPS metadata dictionary from CLLocation and CLHeading for writing to EXIF data in images.
#import <CoreLocation/CoreLocation.h>
#import <ImageIO/ImageIO.h>
@interface CLLocation (EXIFGPS)
- (NSDictionary*) EXIFMetadataWithHeading:(CLHeading*)heading;
@end
@interface NSDate (EXIFGPS)