Skip to content

Instantly share code, notes, and snippets.

@dreyescat
dreyescat / machine.js
Last active January 13, 2021 14:28
Generated by XState Viz: https://xstate.js.org/viz
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
@dreyescat
dreyescat / README.md
Last active April 17, 2017 10:32
webpack resolve alias for relative paths

How to use webpack resolve-alias to solve relative paths.

npm install
mkdir -p src/components/Header
mv index.jsx src/components/Header
mkdir -p src/utils
mv myUtils.js src/utils
npm run build
@dreyescat
dreyescat / index.html
Created December 18, 2015 18:02
Webpack config to expose bundle in a variable in the global context
<html>
<head>
</head>
<body>
<script src="lib/yourlib.js"></script>
<script>
window.onload = function () {
EntryPoint.run();
};
</script>
@dreyescat
dreyescat / gist:562520fceb1569d8389d
Created October 23, 2014 21:36
Sample scrapy hacker news using a CrawlSpider
import scrapy
from scrapy.contrib.spiders import CrawlSpider, Rule
from scrapy.contrib.linkextractors import LinkExtractor
class HackerNewsItem(scrapy.Item):
title = scrapy.Field()
comment = scrapy.Field()
class HackerNewsSpider(CrawlSpider):
@dreyescat
dreyescat / svn_remove
Created May 17, 2012 12:32
Remove svn missing (removed by non-svn command) or incomplete files
#!/usr/bin/env python
import sys
from subprocess import check_output, call
if len(sys.argv) > 2:
sys.exit('Usage: {0} svn-folder'.format(sys.argv[0]))
svn_folder = sys.argv[1] if len(sys.argv) == 2 else '.'
output = check_output(['svn', 'status', svn_folder])