Skip to content

Instantly share code, notes, and snippets.

View stillwyw's full-sized avatar
🌋

yunwei stillwyw

🌋
View GitHub Profile
Model.all.each{|m|m.try(:image).try(:recreate_versions!) rescue (puts m.id) }
@stillwyw
stillwyw / regen.rb
Created August 28, 2019 10:13
Recreate carrier wave verions.
Model.all.each{|m|m.try(:image).try(:recreate_versions!)
@stillwyw
stillwyw / media-query.css
Created November 14, 2018 12:57 — forked from gokulkrishh/media-query.css
CSS Media Queries for Desktop, Tablet, Mobile.
/*
##Device = Desktops
##Screen = 1281px to higher resolution desktops
*/
@media (min-width: 1281px) {
//CSS
@stillwyw
stillwyw / gist:9442818
Created March 9, 2014 04:11
Codes for resizing or cropping a image into proper/wanted size. from http://stackoverflow.com/questions/9894120/uiimageview-fit-to-width
#import "MyImage.h"
@implementation MyImage
+ (UIImage*)imageWithImage:(UIImage *)image convertToWidth:(float)width covertToHeight:(float)height {
CGSize size = CGSizeMake(width, height);
UIGraphicsBeginImageContext(size);
[image drawInRect:CGRectMake(0, 0, size.width, size.height)];
UIImage * newimage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();