Skip to content

Instantly share code, notes, and snippets.

Joe Critchley joecritch

Block or report user

Report or block joecritch

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@kentcdodds
kentcdodds / index.html
Last active Jun 4, 2019
The one true react boilerplate
View index.html
<body>
<div id="⚛️"></div>
<script src="https://unpkg.com/react@16.0.0/umd/react.development.js"></script>
<script src="https://unpkg.com/react-dom@16.0.0/umd/react-dom.development.js"></script>
<script src="https://unpkg.com/babel-standalone@6.26.0/babel.js"></script>
<script type="text/babel">
ReactDOM.render(<div>Hello World!</div>, document.getElementById('⚛️'))
</script>
</body>
@kitten
kitten / reactiveconf-sc-cfp.md
Last active Dec 17, 2018
ReactiveConf 2017 Lightning Talk CFP: With styled-components into the future
View reactiveconf-sc-cfp.md

styled-components Logo

With styled-components into the future

Preprocessing is dead, long live preprocessing!


This is a CFP for ReactiveConf 2017's open call for Lightning talks. If you'd like to see this talk become a reality, please ⭐️ star this gist. #ReactiveConf

View carry.md

Backpack criteria.todo

  • All black, no tacky logos
  • Laptop sleeve
  • Not too officey for hiking or cycling; not too outdoorsy for commuting
  • Waterproofish
  • External water bottle pocket (negates GoRucks etc)
  • ~20-25L
    • small enough to be a personal item on a plane
    • big enough for day-to-day use
  • Doesn't make you look like an accountant
View bloop.js
(function() {
// Do not use this library. This is just a fun example to prove a
// point.
var Bloop = window.Bloop = {};
var mountId = 0;
function newMountId() {
return mountId++;
}
@vojtajina
vojtajina / di-simple-config.js
Created Apr 21, 2014
One possible way of doing configuration with DI. I think we need something nicer...
View di-simple-config.js
function Config() {
this.useFoo = false;
this.log = 'infoo;
}
@Inject(Config)
class SomeService{
constructor(config) {
// ...
@traviskaufman
traviskaufman / jasmine-this-vars.md
Last active Aug 10, 2019
Better Jasmine Tests With `this`
View jasmine-this-vars.md

Better Jasmine Tests With this

On the Refinery29 Mobile Web Team, codenamed "Bicycle", all of our unit tests are written using Jasmine, an awesome BDD library written by Pivotal Labs. We recently switched how we set up data for tests from declaring and assigning to closures, to assigning properties to each test case's this object, and we've seen some awesome benefits from doing such.

The old way

Up until recently, a typical unit test for us looked something like this:

describe('views.Card', function() {
@joecritch
joecritch / with_set_cache.js
Last active Dec 15, 2015
This is a 'utility-belt' mixin for Twitter Flight that improves querying and caching of set's of jQuery selectors. It exposes a clean API for searching through a 'cached tree' of elements.
View with_set_cache.js
///////////////////////
// Example of how to use this mixin....
// - Think of UI components that can
define(
['flight/lib/component', 'mixins/with_set_cache'],
function(defineComponent, withSetCache, _) {
return defineComponent(myComponent, withSetCache);
function myComponent() {
@jonathanmoore
jonathanmoore / gist:2640302
Created May 8, 2012
Get the share counts from various APIs
View gist:2640302

Share Counts

I have always struggled with getting all the various share buttons from Facebook, Twitter, Google Plus, Pinterest, etc to align correctly and to not look like a tacky explosion of buttons. Seeing a number of sites rolling their own share buttons with counts, for example The Next Web I decided to look into the various APIs on how to simply return the share count.

If you want to roll up all of these into a single jQuery plugin check out Sharrre

Many of these API calls and methods are undocumented, so anticipate that they will change in the future. Also, if you are planning on rolling these out across a site I would recommend creating a simple endpoint that periodically caches results from all of the APIs so that you are not overloading the services will requests.

Twitter

@salbito
salbito / gist:1165174
Created Aug 23, 2011 — forked from powmedia/gist:1081802
Backbone.sync for Titanium
View gist:1165174
//Customise Backbone.sync to work with Titanium rather than jQuery
Backbone.sync = (function() {
var methodMap = {
'create': 'POST',
'read' : 'GET',
'update': 'PUT',
'delete': 'DELETE'
};
var xhr = Ti.Network.createHTTPClient({ timeout: 5000 });
@paulirish
paulirish / gist:747835
Created Dec 19, 2010
`x || (x = y)` pattern for using an incoming value otherwise using some default
View gist:747835
// from https://twitter.com/#!/LeaVerou/status/16613276313980929
// this pattern below is common for using an incoming value otherwise using some default.
/* Bad: */ x = x ? x : y; // simple ternary.
// if x is truthy lets use it.
/* Better: */ x = x || y; // logical OR.
// you could string a bunch of these easily to grab the first non-falsy value:
You can’t perform that action at this time.