Class names are CamelCase.
Methods and variables are snake_case.
Methods with a ? suffix will return a boolean.
| import { useReducer, useEffect } from 'react'; | |
| import { useSwipeable, SwipeableHandlers, EventData } from 'react-swipeable'; | |
| function previous(length: number, current: number) { | |
| return (current - 1 + length) % length; | |
| } | |
| function next(length: number, current: number) { | |
| return (current + 1) % length; | |
| } |
| module Model | |
| def initialize(attributes) | |
| self.attributes = attributes | |
| end | |
| def attributes=(hash) | |
| hash.each do |k, v| | |
| send :"#{k}=", v | |
| end | |
| end |
| var EMAIL_DRAFTED = "EMAIL DRAFTED"; | |
| function draftMyEmails() { | |
| var sheet = SpreadsheetApp.getActiveSheet(); // Use data from the active sheet | |
| var startRow = 2; // First row of data to process | |
| var numRows = sheet.getLastRow() - 1; // Number of rows to process | |
| var lastColumn = sheet.getLastColumn(); // Last column | |
| var dataRange = sheet.getRange(startRow, 1, numRows, lastColumn) // Fetch the data range of the active sheet | |
| var data = dataRange.getValues(); // Fetch values for each row in the range | |
| const listeners = (function listAllEventListeners() { | |
| let elements = []; | |
| const allElements = document.querySelectorAll('*'); | |
| const types = []; | |
| for (let ev in window) { | |
| if (/^on/.test(ev)) types[types.length] = ev; | |
| } | |
| for (let i = 0; i < allElements.length; i++) { | |
| const currentElement = allElements[i]; |
| # You don't need Fog in Ruby or some other library to upload to S3 -- shell works perfectly fine | |
| # This is how I upload my new Sol Trader builds (http://soltrader.net) | |
| # Based on a modified script from here: http://tmont.com/blargh/2014/1/uploading-to-s3-in-bash | |
| S3KEY="my aws key" | |
| S3SECRET="my aws secret" # pass these in | |
| function putS3 | |
| { | |
| path=$1 |
| RED="\[\033[0;31m\]" | |
| YELLOW="\[\033[0;33m\]" | |
| GREEN="\[\033[0;32m\]" | |
| CYN='\e[1;96m' | |
| # git dirty branch | |
| function parse_git_dirty { | |
| [[ $(git status 2> /dev/null | tail -n1) != "nothing to commit (working directory clean)" ]] && echo "(._.)" | |
| } | |
| function parse_git_clean { |
| # handle ajax events (loading and auth errors) | |
| $(document).ajaxStart -> | |
| settings = lines: 12, length: 6, width: 4, radius: 8, trail: 75, color: '#fff' | |
| $('.loading-main').html new r.ui.spinner( settings ).spin().el | |
| $('[data-section=logo]').addClass('loading') | |
| $(document).ajaxStop -> | |
| $('[data-section=logo]').removeClass('loading') | |
| $(document).ajaxComplete (e, xhr, options) -> | |
| r.errorHandler.handle(xhr) |
| @font-face { | |
| font-family: 'EntypoRegular'; | |
| src: url('font/entypo.eot'); | |
| src: url('font/entypo.eot?#iefix') format('embedded-opentype'), | |
| url('font/entypo.woff') format('woff'), | |
| url('font/entypo.ttf') format('truetype'), | |
| url('font/entypo.svg#EntypoRegular') format('svg'); | |
| font-weight: normal; | |
| font-style: normal; | |
| } |