Skip to content

Instantly share code, notes, and snippets.

class Month
attr_reader :month, :year, :first_wkday_of_month
# weekdays = "Su Mo Tu We Th Fr Sa"
def initialize(month, year)
@month = month
@year = year
@days_in_month = days_in_month(month, year)
@first_wkday_of_month = Zellers.calculate(month, year)
@rtmalone
rtmalone / gist:ab6e894fc216bab7543e
Created May 31, 2014 19:31
Google Map Nav fix with CSS
If you are using google maps with foundation you may have noticed the nav controls over to map not rendering correctly. It appears some CSS foundation sets interferes with such things on a google map. Here is the fix:
#map img {
max-width: none;
}
http://foundation.zurb.com/forum/posts/173-google-map-css-issue
{
/* ENVIRONMENTS */
// specify a white list of global variables that are not formally defined in the source code.
// See "environment" options in JSHINT Docs
"globals": ["node", "jquery", "browser"],
/* ENFORCING */
// This option requires you to always put curly braces around blocks in loops and conditionals
{
"disallowEmptyBlocks": true,
"disallowKeywordsOnNewLine": ["else"],
"disallowKeywords": ["with"],
"disallowMixedSpacesAndTabs": true,
"disallowMultipleLineBreaks": true,
"disallowMultipleLineStrings": true,
"disallowMultipleSpaces": true,
"disallowNewlineBeforeBlockStatements": true,
"disallowOperatorBeforeLineBreak": ["."],
@rtmalone
rtmalone / htmlplayer.js
Created January 13, 2016 17:44
rabble mobile player
'use strict';
angular.module('rabbleClientApp')
.directive('htmlplayer', function ($rootScope, $state, $timeout, $detection, PlayerUtilsService, constants, LogService, ListensService, SocketUtilsService, MessageService) {
var directive = {
restrict: 'E',
transclude: true,
templateUrl: '/views/templates/htmlplayer.html',
scope :{
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>React Tutorial</title>
<!-- Not present in the tutorial. Just for basic styling. -->
<link rel="stylesheet" href="css/base.css" />
<script src="https://cdnjs.cloudflare.com/ajax/libs/react/0.14.8/react.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/react/0.14.8/react-dom.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/babel-core/5.6.16/browser.js"></script>
@rtmalone
rtmalone / SampleComponent.js
Created April 12, 2017 04:47 — forked from yamadayuki/SampleComponent.js
Use keyframes property with React using inline style
import React from 'react';
import injectStyle from './path/to/injectStyle';
export default class SampleComponent extends React.Component {
constructor(props) {
super(props);
const keyframesStyle = `
@-webkit-keyframes pulse {
0% { background-color: #fecd6d; }
Name of thing Sorta like... Mounted? Can you even setState? What would you say... ya do here?
constructor initialize() nope nope init stuff NO side effects
componentWillMount beforeDomReady() nope yeah but don't Only needed in createClass now use constructor for most things
render render nope please no render stuff and don't set any state please
componentDidMount domReady() yup yup DOM is a go init jQuery plugins dispatch stuff
componentWillReceiveProps onChange() yup yup
const _location = window.location
const uAgent = window.navigator.userAgent.toLowercase()
const query = <grab the query params according to your code base>
if (uAgent.match(/iphone|ipod|ipad/i)) {
handleIOS(location, query)
} else if (uAgent.match(/android/i)) {
handleAndroid(location, query) {
} else {
<User is on a desktop; I just logged a message to the console>