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
@hamin
hamin / VerticalPeekingPagingLayout.h
Last active August 29, 2015 14:07
Vertical Scrolling UICollectionViewLayout Subclass with paging and peeking for next page enabled based on https://github.com/betzerra/EBCardCollectionViewLayout
#import <UIKit/UIKit.h>
@interface VerticalPeekingPagingLayout : UICollectionViewLayout
@property (readonly) NSInteger currentPage;
@property (assign, nonatomic) NSInteger startPage;
@property (nonatomic, assign) UIOffset offset;
@property (nonatomic, strong) NSDictionary *layoutInfo;
@end
package main
import (
"bufio"
"flag"
"fmt"
"io"
"net"
"net/textproto"
"os"
@hamin
hamin / 0_reuse_code.js
Last active August 29, 2015 14:18
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@hamin
hamin / example.rb
Last active August 29, 2015 14:26
An updated Rust 1.x version of Yehuda's Native Rust Extension post here http://blog.skylight.io/bending-the-curve-writing-safe-fast-native-gems-with-rust/
require "./points"
p1 = RustPoint::make_point(10, 10) # => #<Fiddle::Pointer:0x007f8231e56510 ptr=0x0000010b824000 size=0 free=0x00000000000000>
p2 = RustPoint::make_point(20, 20) # => #<Fiddle::Pointer:0x007f8231f20970 ptr=0x0000010b824010 size=0 free=0x00000000000000>
RustPoint::get_distance(p1, p2) # => 14.142135623730951

Keybase proof

I hereby claim:

  • I am hamin on github.
  • I am harisamin (https://keybase.io/harisamin) on keybase.
  • I have a public key whose fingerprint is 4312 6149 4661 B058 D565 4799 AD33 7AA4 4052 82BD

To claim this, I am signing this object:

@hamin
hamin / event.rb
Created June 29, 2010 16:04 — forked from stengland/event.rb
Multi Param Atrributes for MongoMapper ruby 1.8 and ruby 1.9 compliant
class Event
include MongoMapper::Document
include MultiParameterAttributes
key :name, String, :required => true
key :start_date, Date, :required => true
key :start_time, Time, :required => true
end
@hamin
hamin / gist:535041
Created August 18, 2010 15:04 — forked from cheald/gist:535026
MongoMapper CarrierWave adapter
require 'mongo_mapper'
module CarrierWave
module MongoMapper
include CarrierWave::Mount
##
# See +CarrierWave::Mount#mount_uploader+ for documentation
#
def mount_uploader(column, uploader, options={}, &block)
# We need to set the mount_on column (or key in MongoMapper's case)
@hamin
hamin / gist:632799
Created October 18, 2010 18:57
Rvm version in your shell
# Put this at the end of your user's .profile file or .bash_profile file
# NOTE: Here '/Users/hamin/' is MY user folder, replace with yours
if [[ -s /Users/hamin/.rvm/scripts/rvm ]] ; then source /Users/hamin/.rvm/scripts/rvm ; fi
PS1="[\h:\$(~/.rvm/bin/rvm-prompt)]\W \u\$"
group :development do
if RUBY_VERSION =~ /1.9/
gem "ruby-debug19"
else
gem "ruby-debug"
end
end
@hamin
hamin / mongomapper_rails3_template.rb
Created January 20, 2011 22:41
A Rails 3 Application template for MongoMapper
# Some basic flags
use_mongomapper = false
use_compass = false
use_simplenavigation = false
rails3_branch = false
run "cp config/database.yml config/database.example.yml"
# Remove redundant files
remove_file "public/index.html"