Skip to content

Instantly share code, notes, and snippets.

@ryanahamilton
ryanahamilton / Rails Flash Notices and Errors CSS
Created December 16, 2008 15:13
Pretty flash errors and notices that fade
#notice {
border: solid 1px #99cc99;
background-color: #e2f9e3;
color: #006600;
padding: 5px;
margin-bottom: 5px;
}
#notice.error {
border-color: #cc0000;
@ryanahamilton
ryanahamilton / application.js
Created January 12, 2011 22:49
cross-browser input placeholder attribute support with jQuery and Modernizr
$(function(){
if (!Modernizr.input.placeholder){
$('#search input[type="search"]')
.clearValue();
}
});
$.fn.clearValue = function() {
var countdown = (function() {
var index;
function log(){
console.log(index);
}
function iterate(){
log();
if(index>1) setTimeout(iterate, 1000);
function Person(name){
this.name = name;
}
Person.prototype.getName = function() {
return this.name;
}
var thomas = new Person('Thomas');
var amy = new Person('Amy');
http://username:password@www.example.com:443/path/file.name?query=string#anchor
|_____||______| |______| |_____________| |_||_____________||___________||_____|
   |       |       |           |          |         |             |         |
scheme   user   password      host       port      path         query   fragment
|______________________________________________________________________________|
                                       |

url

@ryanahamilton
ryanahamilton / gist:4332324
Last active December 9, 2015 21:39
Preferences.sublime-settings
{
"color_scheme": "Packages/RailsCasts Colour Scheme/RailsCastsColorScheme.tmTheme",
"find_selected_text": true,
"bold_folder_labels": true,
"folder_exclude_patterns":
[
".git",
".sass-cache"
],
"font_face": "Source Code Pro",
@ryanahamilton
ryanahamilton / After
Created October 28, 2013 20:27
SASS Hash as workaround for not being able to interpolate variable names.
a {
display: block;
width: 60px;
height: 60px;
line-height: 70px;
text-align: center;
font-size: 30px;
color: #fff;
@include transition(background-color 0.3s);

Keybase proof

I hereby claim:

  • I am ryanahamilton on github.
  • I am ryanahamilton (https://keybase.io/ryanahamilton) on keybase.
  • I have a public key whose fingerprint is F682 CCD9 F360 833F 3003 863D E8B5 B653 9F42 4A8B

To claim this, I am signing this object:

// @flow
const formatThousandsToK = (val: number | string | null): string => {
const num = Number(val) || 0;
const absNum = Math.abs(num);
const signNum = Math.sign(num);
if (absNum > 999) {
const reduced = signNum * (absNum / 1000);
return `${reduced.toFixed(1)}k`;
// @flow
import React, { type StatelessFunctionalComponent } from 'react';
import gql from 'graphql-tag';
import { Query } from 'react-apollo';
import { Badge } from '~/public/shared/components';
const STATUS_COUNT_QUERY = gql`
query sellerItemStatusCounts($contractId: ID) {
sellerItemStatusCounts(contractId: $contractId) {