Skip to content

Instantly share code, notes, and snippets.

View jkatzer's full-sized avatar

Jason Katzer jkatzer

View GitHub Profile
@jkatzer
jkatzer / bad_scrollmonkey.js
Created July 21, 2015 22:48
disable slack scrolling
TS.client.ui.slowScrollMsgsToPosition = function (v,w,x){var u=TS.model.archive_view_is_showing;
w=w&&!u;
var y;
if(u){TS.client.archives.msgs_are_auto_scrolling=true;
y=TS.client.archives.$scroller
}else{TS.model.ui.msgs_are_auto_scrolling=true;
y=TS.client.ui.$msgs_scroller_div
}y.stop().animate({scrollTop:v},1,function(){setTimeout(function(){if(u){TS.client.archives.msgs_are_auto_scrolling=false
}else{TS.model.ui.msgs_are_auto_scrolling=false
}},1);

Keybase proof

I hereby claim:

  • I am jkatzer on github.
  • I am jkatzer (https://keybase.io/jkatzer) on keybase.
  • I have a public key whose fingerprint is 9FCA 230F 151D 71A5 FF4C EE98 58F8 2C22 4C5E 55E4

To claim this, I am signing this object:

<cfset new_phone = Replace(phone,'-','')>
<cfset new_phone = Replace(new_phone,' ','')>
<cfset new_phone = "(#left(new_phone,3)#) #mid(new_phone,4,3)#-#right(new_phone,4)#" >
#new_phone#
@jkatzer
jkatzer / gist:5022357
Created February 24, 2013 02:45
lazy html/css background color passing to uiwebview. don't think this is necessary but hate for the code to go to waste. i wouldn't use it in a real project, but i just love playing with communication between uiwebview and the document it contains.
-(void)webViewDidFinishLoad:(UIWebView *)webView {
NSString* backgroundColorString = [webView stringByEvaluatingJavaScriptFromString:@"document.body.style.background"];
if ([backgroundColorString length] != 0) {
if ([backgroundColorString rangeOfString:@"rgb("].location == NSNotFound) {
backgroundColorString = [backgroundColorString stringByReplacingOccurrencesOfString:@"rgb(" withString:@""];
backgroundColorString = [backgroundColorString stringByReplacingOccurrencesOfString:@")" withString:@""];
backgroundColorString = [backgroundColorString stringByReplacingOccurrencesOfString:@" " withString:@""];
NSArray* colors = [backgroundColorString componentsSeparatedByString:@","];
webView.backgroundColor = [UIColor colorWithRed:[colors[0] floatValue] green:[colors[1] floatValue] blue:[colors[2] floatValue] alpha:1.0];
@jkatzer
jkatzer / gist:4998065
Created February 20, 2013 18:55
i love objective c for the way you read and write code like this. don't know why, just something nice about it. nice way to toggle screen brightness between max and the users setting. please reset me back to the user settings in viewWillDisappear or something similar.
-(void)toggleScreenBrightness{
if (screenBrightness != -1) {
[[UIScreen mainScreen] setBrightness:screenBrightness];
screenBrightness = -1;
} else {
screenBrightness = [[UIScreen mainScreen] brightness];
[[UIScreen mainScreen] setBrightness:1.0f];
}
}