Skip to content

Instantly share code, notes, and snippets.

@haric
haric / gist:9264af49fdf226967a4c2efd3b3aab87
Created November 25, 2020 17:19
ECS Task Definition Sample
[{
"name": "web",
"image": "988098771143.dkr.ecr.us-east-1.amazonaws.com/ocicb:Latest",
"cpu": 256,
"memory": 512,
"essential": true,
"portMappings": [{
"containerPort": 8080,
"hostPort": 8080
}],
@haric
haric / MQ_chris_coyer
Created May 7, 2014 23:46
Mobile web Media Queries
/* #### Mobile Phones Portrait #### */
@media screen and (max-device-width: 480px) and (orientation: portrait){
/* some CSS here */
}
/* #### Mobile Phones Landscape #### */
@media screen and (max-device-width: 640px) and (orientation: landscape){
/* some CSS here */
}
@haric
haric / Stretch container to fit page height
Last active December 29, 2015 10:29
Stretch container to fit page
/* Set container height to 100% */
body, html {
height: 100%;
}
.container {
height: 100% !important;
}
/* if all fail */
@haric
haric / gist:5326816
Created April 6, 2013 17:02
REST Get with JS
function reqListener () {
// document.write(this.responseText);
document.write(this.response);
};
var oReq = new XMLHttpRequest();
oReq.onload = reqListener;
oReq.open("get", "https://www.googleapis.com/books/v1/volumes?q=quilting", true);
oReq.send();
@haric
haric / gist:3248178
Created August 3, 2012 14:35
Different fonts in one label
CGContextRef context = UIGraphicsGetCurrentContext();
// ERASE BACKGROUND
CGContextSetRGBStrokeColor(context, 0.0, 0.0, 0.0, 1.0);
CGContextSetRGBFillColor(context, 0.0, 0.0, 0.0, 1.0);
CGContextFillRect(context, rect);
// DRAW TEXT
[[UIColor whiteColor] set];
UIFont * font = [UIFont fontWithName:@"ArialMT" size:12];
@haric
haric / gist:3248172
Created August 3, 2012 14:34
Debug-only logging
#ifdef DEBUG
# define DLog(fmt, ...) NSLog((@"%s [Line %d] " fmt), __PRETTY_FUNCTION__, __LINE__, ##__VA_ARGS__);
#else
# define DLog(...)
#endif
// ALog always displays output regardless of the DEBUG setting
#define ALog(fmt, ...) NSLog((@"%s [Line %d] " fmt), __PRETTY_FUNCTION__, __LINE__, ##__VA_ARGS__);
@haric
haric / fileupload.js
Created June 14, 2012 14:55
fileUpload
<!DOCTYPE html>
<html>
<head>
<title>Upload Files using XMLHttpRequest - Minimal</title>
<script type="text/javascript">
function fileSelected() {
var file = document.getElementById('fileToUpload').files[0];
if (file) {
var fileSize = 0;
@haric
haric / gist:2930827
Created June 14, 2012 14:54
Detect 32-bit or 64-bit Mac
ioreg -l -p IODeviceTree | grep firmware-abi
@haric
haric / gist:2930825
Created June 14, 2012 14:53
Create sim-compatible library
#! /bin/sh
# Find and remove
find . -type f -name *.m | xargs rm
# Combine device and sim libs
lipo -create -output libMyLibrary.a libMyLibrary-Device.a libMyLibrary-Simulator.a
@haric
haric / gist:2930817
Created June 14, 2012 14:52
Uninstall xcode
sudo /Developer/Library/uninstall-devtools --mode=all