Skip to content

Instantly share code, notes, and snippets.

View hamin's full-sized avatar

Haris Amin hamin

  • Currently ionq.co. Previously symbiont.io, getpager.com, itsglimpse.com, dailburn.com
  • New York,NY
View GitHub Profile
//
// SSScrollView.h
//
/*
Get a delegate callback when the scroll view scrolls.
*/
#import <Cocoa/Cocoa.h>
@astroud
astroud / DigitalColor-Meter-fix.scpt
Created January 31, 2012 21:34
Lion's DigitalColor Meter defaults to displaying color values as decimals instead of hex. Loading DigitalColor Meter via this AppleScript remedies that.
-- Mountain Lion (10.8) fixed this oversight. The DigitalColor Meter now remembers it's settings on exit.
-- DigitalColor Meter defaults to displaying color values in decimal and will not remember hexidecimal preferences on close. So this script launches the app and tells it to display values in hex. It is meant to be launched via QuickSilver or a launcher.
-- Checks to see if System Preferences > Universal Access > Enable access for assistive devices is checked
-- This option is required for "System Events" to use the keystroke and key code commands.
-- If it is not checked, your password is required to make the change
tell application "System Events" to if not UI elements enabled then
set UI elements enabled to true
@kyledrake
kyledrake / gist:2119737
Created March 19, 2012 17:13
How to rotate logs with Rainbows!
# Put this in a logrotate file (like /etc/logrotate.d/yourcompany):
/var/log/yourcompany/website.log
{
daily
rotate 7
compress
missingok
notifempty
sharedscripts
size 5M
@hamin
hamin / rounded_corners.m
Created March 23, 2012 21:20
Cocoa (OS X) rounded corners
NSBezierPath *roundedRect = [NSBezierPath bezierPathWithRoundedRect:[self bounds] xRadius:6.0 yRadius:6.0];
[roundedRect fill];
@clr
clr / access.log
Created October 30, 2012 22:21
Wide Finder ErlangGames
208.115.113.86 - - [29/Oct/2012:17:11:45 -0700] "GET /Case%20History/new_page_1.htm HTTP/1.1" 404 89 "-" "Mozilla/5.0 (compatible; Ezooms/1.0; ezooms.bot@gmail.com)" "dakotalargeanimalclinic.com"
218.30.103.53 - - [29/Oct/2012:17:37:02 -0700] "GET /robots.txt HTTP/1.1" 200 54 "-" "Sogou web spider/4.0(+http://www.sogou.com/docs/help/webmasters.htm#07)" "www.dakotalargeanimalclinic.com"
208.115.111.70 - - [29/Oct/2012:17:46:47 -0700] "GET /robots.txt HTTP/1.1" 200 54 "-" "Mozilla/5.0 (compatible; Ezooms/1.0; ezooms.bot@gmail.com)" "dakotalargeanimalclinic.com"
74.125.182.28 - - [29/Oct/2012:17:54:04 -0700] "GET /Equine_Nutrition/teeth_check_horse.html HTTP/1.1" 200 4111 "http://www.google.com/search" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.4 (KHTML, like Gecko; Google Web Preview) Chrome/22.0.1229 Safari/537.4" "www.dakotalargeanimalclinic.com"
70.238.130.51 - - [29/Oct/2012:17:54:04 -0700] "GET /photo_gallery/black_cat_mouth_open.JPG HTTP/1.1" 200 632815 "http://www.google.com/search?num=10&hl=en&sit
@moudy
moudy / PomTaskView+Constraints.m
Last active December 22, 2015 18:49
Constraints category
#import "PomTaskView+Constraints.h"
@implementation PomTaskView (Constraints)
- (void)updateConstraints {
[super updateConstraints];
NSMutableArray *constraints = [NSMutableArray new];
NSDictionary *views = [self subviewsDictionary];
@kyledrake
kyledrake / gist:1498932
Last active August 2, 2016 04:31
Neocities' Rainbows! config file - https://neocities.org
# This is Neocities' Rainbows! config file. We are using this in production to run all our web apps.
# It works really well for us and has been heavily load tested, so I wanted to share it with the community.
#
# In my opinion, this is the best way to deploy a ruby web application. Unlike EventMachine based solutions,
# it uses real ruby threads, which allows it to take advantage of the internal non-blocking IO pattern
# in MRI.
#
# Contrary to popular belief, MRI doesn't block execution to wait on IO when you are using threads, even
# with the GIL. The requests are done concurrently for anything that is based on the IO class. This
# includes things like Net::HTTP and even `system commands`. Grep the MRI Ruby source code for
@hatfinch
hatfinch / CGAffineTransformFromRectToRect.m
Created August 17, 2011 09:54
CGAffineTransformFromRectToRect (not working)
CGAffineTransform CGAffineTransformFromRectToRect(CGRect fromRect, CGRect toRect)
{
CGSize scale = CGSizeMake(toRect.size.width / fromRect.size.width, toRect.size.height / fromRect.size.height);
CGRect scaledFromRect = CGRectMake(fromRect.origin.x * scale.width, fromRect.origin.y * scale.height,
fromRect.size.width * scale.width, fromRect.size.height * scale.height);
CGSize translation = CGSizeMake(fromRect.origin.x - scaledFromRect.origin.x, fromRect.origin.y - scaledFromRect.origin.y);
return CGAffineTransformMake(scale.width, 0.0, 0.0, scale.height, translation.width, translation.height);
}
@jcmartins
jcmartins / gist:ce8951db811086fc02f5
Last active October 31, 2019 15:11
Grafana with Google Auth
###GOOGLE Console DEV
Original JavaScript autorized
http://grafana.mydomain.com.br
URIs redirect autorized
http://grafana.mydomain.com.br:3000/login/google
### NGINX PROXY
server {
@jpo
jpo / progress_indicators.rb
Created July 31, 2012 02:23
Ruby CLI Progress Indicators
# Terminal Progress Indicators. Four examples are included: percentage,
# spinner, progress bar, and combined. This script has been tested on
# Mac OS X 10.8 with Ruby 1.8.7, 1.9.1, 1.9.2, and 1.9.3
class Spinner
include Enumerable
def each
loop do
yield '|'
yield '/'