Skip to content

Instantly share code, notes, and snippets.

View mrkev's full-sized avatar

Kevin Chavez mrkev

View GitHub Profile
@mrkev
mrkev / dabblet.css
Created March 19, 2012 06:15
The first commented line is your dabblet’s title
/**
* The first commented line is your dabblet’s title
*/
background: #f06;
background: linear-gradient(45deg, #f06, yellow);
min-height: 100%;
width: 100px;
@mrkev
mrkev / dabblet.css
Created March 25, 2012 01:30
Dabblet
/**
* Dabblet
*/
background: #f06;
background: linear-gradient(45deg, #f06, yellow);
min-height: 100%;
width: 100px;
-webkit-transform:rotate(30deg);
@mrkev
mrkev / HTML5 + jQuery 1.8.3 + IE fix + reset (+ Fixie)
Last active December 10, 2015 07:18
A HTML5 template with jQuery 1.8.3 (http://jquery.com) hosted through Google APIs (https://developers.google.com/speed/libraries/devguide#Libraries), the ie7-js IE fix (https://code.google.com/p/ie7-js/) and the reset5 reset css (http://code.google.com/p/reset5/). Also includes Fixie (http://fixiejs.com/), a little script to add placeholder text…
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>Title</title>
<meta name="author" content="" media="screen">
<meta name="description" content="" media="screen">
<link href="http://reset5.googlecode.com/hg/reset.min.css" rel="stylesheet" />
@mrkev
mrkev / CSS Transition - All browsers
Created January 6, 2013 06:13
Transitions for all browsers, all properties, 0.5. Mainly for convenience and reference.
-webkit-transition: all 0.5s ease;
-moz-transition: all 0.5s ease;
-o-transition: all 0.5s ease;
transition: all 0.5s ease;
@mrkev
mrkev / Obj-C + JS communication in WebView
Last active December 11, 2015 12:38
Will intercept URLs called from WebView, looking for those starting with "osx" Uses selectors called through a url following the format "osx:selector:arg1:arg2:etc... (Example: "osx:beep") Requires the class to be the PolicyDelegate for the webView. Will work with any web request sent by the WebView, so in theory "<a href="osx:beep">Beep!</a>" c…
/*
Intercepts navigation actions in the html document and translates them to selectors when applicable
*/
- (void)webView:(WebView *)webView decidePolicyForNavigationAction:(NSDictionary *)actionInformation request:(NSURLRequest *)request frame:(WebFrame *)frame decisionListener:(id<WebPolicyDecisionListener>)listener
{
NSArray *call = [[[request URL] absoluteString] componentsSeparatedByCharactersInSet:[NSCharacterSet characterSetWithCharactersInString:@":"]];
// Find OSX protocol.
if ([call[0] isEqualToString:@"osx"]) {
@mrkev
mrkev / Obj-C + JS communication - JS Side
Created February 23, 2013 06:11
Requires the URL calls to be intercepted from the WebView. See https://gist.github.com/mrkev/4602188
App = new Object();
// Send message to application
// with the format osx:selector:attr1:attr2:etc...
App.sel = function (sel){
var iframe = document.createElement('iframe');
iframe.setAttribute('src', 'osx:' + sel);
document.documentElement.appendChild(iframe);
iframe.parentNode.removeChild(iframe);
iframe = null;
}
@mrkev
mrkev / dabblet.css
Created February 24, 2013 00:39 — forked from LeaVerou/dabblet.css
Scrolling shadows by @kizmarh and @LeaVerou
/**
* Scrolling shadows by @kizmarh and @leaverou
* Only works in browsers supporting background-attachment: local; & CSS gradients
* Degrades gracefully
*/
html {
background: white;
font: 120% sans-serif;
}
- (NSArray *)allTLDArray {
return [NSArray arrayWithObjects:@"AC", @"AD", @"AE", @"AERO", @"AF", @"AG", @"AI", @"AL", @"AM", @"AN", @"AO", @"AQ", @"AR", @"ARPA", @"AS", @"ASIA", @"AT", @"AU", @"AW", @"AX", @"AZ", @"BA", @"BB", @"BD", @"BE", @"BF", @"BG", @"BH", @"BI", @"BIZ", @"BJ", @"BM", @"BN", @"BO", @"BR", @"BS", @"BT", @"BV", @"BW", @"BY", @"BZ", @"CA", @"CAT", @"CC", @"CD", @"CF", @"CG", @"CH", @"CI", @"CK", @"CL", @"CM", @"CN", @"CO", @"COM", @"COOP", @"CR", @"CU", @"CV", @"CW", @"CX", @"CY", @"CZ", @"DE", @"DJ", @"DK", @"DM", @"DO", @"DZ", @"EC", @"EDU", @"EE", @"EG", @"ER", @"ES", @"ET", @"EU", @"FI", @"FJ", @"FK", @"FM", @"FO", @"FR", @"GA", @"GB", @"GD", @"GE", @"GF", @"GG", @"GH", @"GI", @"GL", @"GM", @"GN", @"GOV", @"GP", @"GQ", @"GR", @"GS", @"GT", @"GU", @"GW", @"GY", @"HK", @"HM", @"HN", @"HR", @"HT", @"HU", @"ID", @"IE", @"IL", @"IM", @"IN", @"INFO", @"INT", @"IO", @"IQ", @"IR", @"IS", @"IT", @"JE", @"JM", @"JO", @"JOBS", @"JP", @"KE", @"KG", @"KH", @"KI", @"KM", @"KN", @"KP", @"KR", @"KW
@mrkev
mrkev / private static BufferedReader openFile(String filename) throws FileNotFoundException
Created April 10, 2014 07:25
Open String filepath to BufferedReader (Doesn't include imports).
/**
* Opens a file into a BufferedReader.
*
* @param filename A file to read.
* @return A BufferedReader for reading the file.
* @throws FileNotFoundException
*/
private static BufferedReader openFile(String filename) throws FileNotFoundException {
return new BufferedReader(new FileReader(filename));
}
@mrkev
mrkev / designer.html
Created June 27, 2014 21:52
designer
<link rel="import" href="../google-map/google-map.html">
<polymer-element name="my-element">
<template>
<style>
:host {
position: absolute;
width: 100%;
height: 100%;