Skip to content

Instantly share code, notes, and snippets.

def three_periods_to_ellipsis
self.gsub("...", "…")
end
def straight_double_quotes_to_smart_double_quotes
self.gsub(/\B"\b([^"“”„‟″‶\r\n]+)\b"\B/, '“\1”')
end
def straight_single_quotes_to_smart_single_quotes
self.gsub(/\B'\b([^'‘’‚‛′‵\r\n]+)\b'\B/, '‘\1’')
@tomasc
tomasc / gist:8623105
Created January 25, 2014 20:30
Nokogiri and Ubuntu 13
bundle config build.libxml-ruby --with-xml2-lib=/usr/local/rvm/usr/lib --with-xml2-include=/usr/local/rvm/usr/include/libxml2
bundle config build.nokogiri --with-xml2-lib=/usr/local/rvm/usr/lib --with-xml2-include=/usr/local/rvm/usr/include/libxml2
require 'nokogiri'
module Modulor
# Performs gsub while ignoring HTML tags and their attributes.
#
# Usage:
# repl = Modulor::StringReplacer.new('<a href="/en/Foo" class="foo">foo</a>')
# repl.gsub(/foo/i, 'bar')
# repl.to_html => '<a href="/en/Foo" class='foo'>bar</a>'
@tomasc
tomasc / long_descriptions.html
Last active October 28, 2016 17:19
LONG DESCRIPTIONS
<!DOCTYPE html>
<html>
<head>
<title>LONG DESC</title>
</head>
<body>
<!-- On thumbnails (all images that link to other page with more information) we would set alt="" -->
<!-- On thumbnails, we do not expose the long descriptions -->
<a href="" aria-label="Propeller Group. Image description: content of alt tag">

Keybase proof

I hereby claim:

  • I am tomasc on github.
  • I am tomasce (https://keybase.io/tomasce) on keybase.
  • I have a public key ASC7paF8AFY55qwkW0wy_Of_enWXHUS00zWg0Lllrwz87Ao

To claim this, I am signing this object:

import React, { Component } from 'react';
import { AppRegistry, FlatList } from 'react-native';
import { StyleSheet, Text, View, ScrollView } from 'react-native';
import WKWebView from 'react-native-wkwebview-reborn';
class WKWebViewTest extends Component {
renderItem = ({item, index}) => (
<WKWebView
style={{ height: 500 }}
#!/bin/bash
PROJECT_NAME=krabbesholm
cd ~/$PROJECT_NAME
# =====================================================================
if [ $# -eq 0 ]; then
echo "No branch name provided."
<div class="long_desc_module__toggle">
<input aria-label="Enable Visual Image Description Layer. This checkbox does not affect screen reader functionality." id="5a4c910a749332336d9ccb84_checkbox" type="checkbox">
<label for="5a4c910a749332336d9ccb84_checkbox" aria-label="Enable visual layer of image descriptions. Not needed for screen-reader users.">
<div class="long_desc_module__toggle__label">Image Descriptions</div>
</label>
</div>
@tomasc
tomasc / dependent_fields.coffee
Created April 29, 2018 15:24
dependent fields
import _ from 'lodash'
export default class DependentFields extends Modulor.Plugin
@defaults =
debug: false
name: 'Modulor__DependentFields'
# add the <%= Bem.bems :modulor_dependent_fields, :scope %> class on parent element
# in order to prevent dependent fields influencing for example nested fields
scope_selector: "bems(modulor_dependent_fields, scope), bems(modulor_nested_fields, item), form"
export default class IsSortable extends Modulor.Plugin
@defaults =
debug: false
name: 'Modulor__NestedFields__IsSortable'
@selector: "bems(modulor_nested_fields, is_sortable)"
on_init: ->
return if @sortable