Skip to content

Instantly share code, notes, and snippets.

View tmilewski's full-sized avatar
👋

Tom Milewski tmilewski

👋
View GitHub Profile
@sindresorhus
sindresorhus / esm-package.md
Last active April 18, 2024 06:02
Pure ESM package

Pure ESM package

The package that linked you here is now pure ESM. It cannot be require()'d from CommonJS.

This means you have the following choices:

  1. Use ESM yourself. (preferred)
    Use import foo from 'foo' instead of const foo = require('foo') to import the package. You also need to put "type": "module" in your package.json and more. Follow the below guide.
  2. If the package is used in an async context, you could use await import(…) from CommonJS instead of require(…).
  3. Stay on the existing version of the package until you can move to ESM.
@zhengjia
zhengjia / capybara cheat sheet
Created June 7, 2010 01:35
capybara cheat sheet
=Navigating=
visit('/projects')
visit(post_comments_path(post))
=Clicking links and buttons=
click_link('id-of-link')
click_link('Link Text')
click_button('Save')
click('Link Text') # Click either a link or a button
click('Button Value')
@paulnicholson
paulnicholson / powssl
Last active November 24, 2021 16:40
ssl with pow using stud

Instructions

  • Install stud $ brew install https://raw.github.com/paulnicholson/homebrew/master/Library/Formula/stud.rb
  • Download and install the powssl script $ curl https://gist.githubusercontent.com/paulnicholson/2050941/raw/7e4d2178e3733bed18fdfe737277c3cb72241d39/powssl > ~/bin/powssl $ chmod +x ~/bin/powssl
  • Run powssl to create development certificate and configure stud.
  • $ powssl
/* The Grid ---------------------- */
.lt-ie9 .row { width: 940px; max-width: 100%; min-width: 768px; margin: 0 auto; }
.lt-ie9 .row .row { width: auto; max-width: none; min-width: 0; margin: 0 -15px; }
.lt-ie9 .row.large-collapse .column,
.lt-ie9 .row.large-collapse .columns { padding: 0; }
.lt-ie9 .row .row { width: auto; max-width: none; min-width: 0; margin: 0 -15px; }
.lt-ie9 .row .row.large-collapse { margin: 0; }
.lt-ie9 .column, .lt-ie9 .columns { float: left; min-height: 1px; padding: 0 15px; position: relative; }
.lt-ie9 .column.large-centered, .columns.large-centered { float: none; margin: 0 auto; }
@cpatni
cpatni / app.rb
Created November 21, 2011 22:39
unique calculation using redis
require 'sinatra'
require 'redis'
require 'json'
require 'date'
class String
def &(str)
result = ''
result.force_encoding("BINARY")
@bensheldon
bensheldon / app_delegate.rb
Last active May 16, 2020 18:09
Creating a flat navigation bar in a RubyMotion iOS iPhone app. (screenshot in the comments)
class AppDelegate
def application(application, didFinishLaunchingWithOptions:launchOptions)
# ...
navigation_appearance
#...
end
def navigation_appearance
# Background Color
@matt-bailey
matt-bailey / formstack-embed-using-postscribe.html
Created September 13, 2017 11:34
Embed a Formstack form asynchronously, using Postscribe
// https://github.com/krux/postscribe
<!-- Main form wrapper, required for styling the form -->
<div class="webform">
<!-- Empty div (must have a unique ID), into which the form will be loaded -->
<div id="formstack-bridal-appointment"></div>
<script type="text/javascript">// <![CDATA[
// Only run the code below when jQuery says the document is ready
(function($) {
// Process the form using postscribe:
// 1. Must reference the unique ID of the div above
@tmilewski
tmilewski / lowerword.sql
Created October 18, 2010 14:08
MySQL: Title Case
-- --------------------------------------------------------------------------------
-- Routine DDL
-- --------------------------------------------------------------------------------
DELIMITER $$
CREATE DEFINER=`root`@`localhost` FUNCTION `lowerword`( str VARCHAR(128), word VARCHAR(5) ) RETURNS varchar(128) CHARSET utf8
BEGIN
DECLARE i INT DEFAULT 1;
DECLARE loc INT;
@tmilewski
tmilewski / facebook_registration.rb
Created May 7, 2012 22:23 — forked from nicalpi/facebook_registration.rb
Testing Omniauth with Devise, Rspec and Capybara
background do
set_omniauth()
click_link_or_button 'Sign up with Facebook'
end
@newtonapple
newtonapple / rturk.rb
Created October 30, 2009 23:21
RTurk Example
RTurk.setup(AWSAccessKeyId, AWSAccessKey, :sandbox => true)
hit = RTurk::Hit.create(:title => "New Upload 3 Documents") do |hit|
hit.assignments = 500
hit.description = "no copytrighted materials!"
hit.question("http://localhost:3000/mturk")
hit.reward = 0.10
hit.qualifications.add :approval_rate, { :gt => 85 }
end