Skip to content

Instantly share code, notes, and snippets.

View Sparragus's full-sized avatar
🛠️
Follow me on twitter: https://twitter.com/sparragus

Richard B. Kaufman-López Sparragus

🛠️
Follow me on twitter: https://twitter.com/sparragus
View GitHub Profile
@Sparragus
Sparragus / index.html
Created April 3, 2014 00:55
processingReadsFromJavascript: A proof of concept. Shows that Processing can read from the Javascript global scope. To check it out, download the gist and open index.html on your browser.
<!DOCTYPE html>
<html>
<head>
<title>Processing reads from Javascript</title>
<script src="processing.min.js"></script>
</head>
<body>
<script type="text/javascript">
// Here is a variable that has been declared in processing.
@Sparragus
Sparragus / JSONForm.jsx
Last active April 17, 2023 19:25
A react component that sends form data in json format.
var React = require('react');
// JSONFormData - https://github.com/roman01la/JSONFormData
// Only works on the browser.
require('../../vendor/JSONFormData/src/json-formdata');
var JSONForm = React.createClass({
propTypes: {
method: React.PropTypes.string.isRequired,
action: React.PropTypes.string.isRequired
@Sparragus
Sparragus / index.js
Created September 30, 2015 02:53
slack-taco-tweet/index.js
// index.js
var request = require('request')
var TwitterAPI = require('twitter')
var twitter = new TwitterAPI({
consumer_key: 'TWITTER_CONSUMER_KEY',
consumer_secret: 'TWITTER_CONSUMER_SECRET',
access_token_key: 'TWITTER_ACCESS_TOKEN',
access_token_secret: 'TWITTER_ACCESS_TOKEN_SECRET'
@Sparragus
Sparragus / index.js
Created September 30, 2015 02:54
slack-hello-world/index.js
// index.js
var request = require('request')
// Esta variable contiene el URL que Slack nos provee
var webhookURL = 'AQUI_PEGAS_LA_WEBHOOK_URL'
// Este es el mensaje que queremos enviar
var payload = {
text: 'Hello, World!'
}
git log --graph --pretty=format:"%Cred%h%Creset - %C(yellow)%d %Creset%s %Cgreen(%cr) %C(bold blue)<%an>%Creset" --all
@Sparragus
Sparragus / gist:512b692f116cdda0689e1d1f48c91b41
Last active June 5, 2017 16:42
Resolve `yarn.lock` merge conflicts
git checkout -- yarn.lock
yarn install
git add yarn.lock
git rebase --continue
@Sparragus
Sparragus / .flowconfig
Created June 3, 2017 14:09
Flow module name mapping
[options]
module.name_mapper='^@src\(.*\)$' -> '<PROJECT_ROOT>/src\1'
@Sparragus
Sparragus / eslint-plugin.js
Created October 28, 2017 06:37
Eslint plugin with a rule that enforces blank lines between sibling JSX elements
const JSXELEMENT_CHILDREN = [
'JSXText',
'JSXExpressionContainer',
'JSXSpreadChild',
'JSXElement',
'JSXFragment'
]
const isJSXElementChildrenType = x => x && JSXELEMENT_CHILDREN.includes(x.type)
module.exports = {
// Icon.test.js
import React from 'react'
import { shallow } from 'enzyme'
import Icon from './Icon'
describe('Icon', () => {
let tree, props
const buildTree = (newProps = {}) => {
// Icon.js
import React from 'react'
export default function Icon ({ name }) {
const className = `icon-${name}`
return (
<i className={className} />
)
}