An exploration of the different render methods available in react-enzyme.
<?php | |
// When loading WP from phpunit, phpunit doesn't run WP in the global scope. | |
// This breaks WP. This is an attempt to fix it. | |
function de_globalize_wp() { | |
// pretend this is apache | |
// I use $_SERVER['HTTP_HOST'] or a file called "host" to get the right DB settings | |
$_SERVER['HTTP_HOST'] = trim(file_get_contents(__DIR__ . '/host')); |
/* | |
* CSS Time to Milliseconds | |
* by Jake Bellacera (http://jakebellacera.com) | |
* ============================================ | |
* | |
* Converts CSS time into milliseconds. Useful for timing functions around CSS animations. | |
* It supports both seconds (s) and milliseconds (ms). | |
* | |
* Arguments: | |
* time_string - string representation of a CSS time unit (e.g. "1500ms" or "1.5s") |
They say that one of the pros of NodeJS is that you use the same language on the back-end and the front-end, so it's easy to share code between them. This sounds great in theory, but in practice the synchronous dependency handling in NodeJS works completely different than any client-side frameworks (which are asynchronous).
Usually that means that you end up copy-pasting your code between your NodeJS sources and your client-side sources, or you use some tool like Browserify, which is brilliant, but they add an extra step in the build process and most likely will conflict with the dependency handling of the framework of your choice (like AnularJS DI). I couldn't look in the mirror if I would call that code sharing.
Fortunately, with a couple of lines of boilerplate code, you can write a module which works in NodeJS and AngularJS as well without any modification.
No globals in the front-end, and dependencies will work. The isNode and isAngular va
const MODULE_DIR = /(.*([\/\\]node_modules|\.\.)[\/\\](@[^\/\\]+[\/\\])?[^\/\\]+)([\/\\].*)?$/g; | |
{ | |
loader: 'babel-loader', | |
test: /\.jsx?$/, | |
include(filepath) { | |
if (filepath.split(/[/\\]/).indexOf('node_modules')===-1) return true; | |
let pkg, manifest = path.resolve(filepath.replace(MODULE_DIR, '$1'), 'package.json'); | |
try { pkg = JSON.parse(fs.readFileSync(manifest)); } catch (e) {} | |
return !!(pkg.module || pkg['jsnext:main']); |
!pip install fastai | |
!apt-get -qq install -y libsm6 libxext6 && pip install -q -U opencv-python | |
import cv2 | |
from os import path | |
from wheel.pep425tags import get_abbr_impl, get_impl_ver, get_abi_tag | |
platform = '{}{}-{}'.format(get_abbr_impl(), get_impl_ver(), get_abi_tag()) | |
accelerator = 'cu80' if path.exists('/opt/bin/nvidia-smi') else 'cpu' | |
!pip install -q http://download.pytorch.org/whl/{accelerator}/torch-0.3.0.post4-{platform}-linux_x86_64.whl torchvision |
var IMAGE_MIME_REGEX = /^image\/(p?jpeg|gif|png)$/i; | |
var loadImage = function (file) { | |
var reader = new FileReader(); | |
reader.onload = function(e){ | |
var img = document.createElement('img'); | |
img.src = e.target.result; | |
var range = window.getSelection().getRangeAt(0); | |
range.deleteContents(); |
#!/usr/bin/sh | |
rm -rf "$HOME/Library/Preferences/WebIde40" | |
rm -rf "$HOME/Library/Caches/WebIde40" | |
rm -rf "$HOME/Library/Application Support/WebIde40" | |
rm -rf "$HOME/Library/Logs/WebIde40" |
Here we use Homebrew to install rbenv:
brew update; and brew install rbenv ruby-build
- Add
~/.rbenv/shims
to your PATH - Include the contents of completions/rbenv.fish in your Fish config.
- Run
rbenv install 2.2.2
andrbenv rehash
- Run
rbenv global 2.2.2
Now you can run gem install bundler
and bundle install
within your Ruby project.
{ | |
"name" : "rarst/install-test", | |
"description" : "Test project for WordPress stack via Composer", | |
"authors" : [ | |
{ | |
"name" : "Andrey Savchenko", | |
"homepage": "http://www.Rarst.net/" | |
} | |
], | |
"type" : "project", |