This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Trying to implement field uniqueness as described in: | |
// https://aws.amazon.com/blogs/database/simulating-amazon-dynamodb-unique-constraints-using-transactions/ | |
// Using: | |
// mocha: v10.2.0 | |
// node: v18.18.2 | |
// macOS: Sonoma v14.1 (23B74) | |
import sinon from 'sinon'; // [email protected] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// src/components/Foo.js | |
import createClass from 'create-react-class'; | |
import { div, em } from 'react-dom-factories'; | |
import PropTypes from 'prop-types'; | |
export default createClass({ | |
displayName: 'Foo', | |
contextTypes: { | |
count: PropTypes.number |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict'; | |
/////////////////////////////////////////////////////////////////////////////// | |
// USAGE: jscodeshift ./lib/ -t ./scripts/codemod-react-proptypes.js | |
/////////////////////////////////////////////////////////////////////////////// | |
module.exports = function(file, api){ | |
var js = api.jscodeshift, | |
root = js(file.source), | |
shouldFixWhitespace, | |
collection; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
here's an interesting snippet from my `stats.json` file as generated by webpack v2.2.1 | |
notes: | |
+ for brevity, i've stripped out the actual "source": field | |
+ the only modules i recognize in the block copied below are: | |
* dom.js (/path/to/my/project/lib/client/util/dom.js - a module i wrote) | |
* transit.js (/path/to/my/project/node_modules/transit-js/transit.js - a dependency of a dependency) | |
+ both dom.js and transit.js use `Buffer` in the node.js context only (e.g. if node.js, use Buffer, else other thing) | |
+ `"userRequest": "Buffer"` <-- does this mean webpack found a mention of the `Buffer` variable and that's why it's being included? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!doctype html> | |
<html lang="en"> | |
<head> | |
<meta charset="utf-8" /> | |
<meta name="HandheldFriendly" content="True" /> | |
<meta name="MobileOptimized" content="320" /> | |
<meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1, maximum-scale=1, user-scalable=no, shrink-to-fit=no" /> | |
<style> | |
html, | |
body { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head></head> | |
<body> | |
<!-- #container wraps the entire page's markup (except on-demand stuff like modals) --> | |
<!-- #container's children and classnames change based on the current view / route --> | |
<div id="#container" class="VIEW VIEW--MODE"> | |
<nav></nav> | |
<header></header> | |
<main></main> | |
<footer></footer> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
app.factory('fileUpload', function($q){ | |
return { | |
send: function(files){ | |
var deferred = $q.defer(), | |
data = new FormData(), | |
xhr = new XMLHttpRequest(); | |
angular.forEach(files, function(file){ | |
data.append('file', file, file.name); | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
app.config(function($routeProvider, $locationProvider){ | |
$locationProvider.html5Mode(true).hashPrefix('!'); | |
$routeProvider | |
.when('/', { | |
templateUrl: '/html/home.html', | |
controller: 'HomeCtrl' | |
}) | |
.when('/templates', { | |
templateUrl: '/html/tmpl.list.html', | |
controller: 'TmplCtrl' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
define( [ 'jquery', 'mods/crazydot' ], function( $, CrazyDot ){ | |
var dots = []; | |
var setup = function( cfg ){ | |
while ( dots.length < cfg.count ){ | |
dots.push( new CrazyDot( cfg.speed, 'body' ).move() ); | |
} | |
}; | |
var stopGame = function(){ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function(root, factory) { | |
if (typeof exports === 'object') { | |
// Node/CommonJS | |
factory(require('jquery')); | |
} else if (typeof define === 'function' && define.amd) { | |
// AMD. Use a named plugin in case this | |
// file is loaded outside an AMD loader, | |
// but an AMD loader lives on the page. | |
define('myPlugin', ['jquery'], factory); | |
} else { |
NewerOlder