Skip to content

Instantly share code, notes, and snippets.

View dariocravero's full-sized avatar

Darío Javier Cravero dariocravero

View GitHub Profile
@dariocravero
dariocravero / all-in-one.md
Last active November 10, 2015 10:47
babel 6 upgrade guide (from 5)

Run:

npm i --save-dev babel-cli babel-preset-stage-0 babel-preset-es2015 babel-preset-react

.babelrc:

{
@dariocravero
dariocravero / index.html
Created August 12, 2015 19:41
sideways animation
<!doctype html>
<html>
<body style='display: flex; flex-direction: row; width: 200vw; margin: 0; align-items: center; height: 100vh;'>
<div id=panel-1 style='background: red; width: 100vw; height: 100px; font-size: 3em; color:
white;'>1</div>
<div id=panel-2 style='background: blue; width: 100vw; height: 100px; font-size: 3em; color:
white;'>2</div>
<script src=sideways.js></script>
</body>
</html>
app.directive("panelWidgetResourceSend", ["$http", "$rootScope", "$timeout", function($http) {
return {
restrict: "A",
controller: ["$scope", "$element", function($scope, $element) {
$scope.sent = !1,
$scope.sending = !1,
$scope.failed = !1,
$scope.sendResource = function($event) {
if ($scope.resource) {
if ($scope.resource.$invalid) {
def nearby_az(string)
(string =~ /a[a-z]{0,2}z/) != nil
end
def test
puts("nearby_az('baz') == true: #{nearby_az('baz') == true ? '.' : 'x'}")
puts("nearby_az('abz') == true: #{nearby_az('abz') == true ? '.' : 'x'}")
puts("nearby_az('abcz') == true: #{nearby_az('abcz') == true ? '.' : 'x'}")
puts("nearby_az('abcwz') == true: #{nearby_az('abcz') == true ? '.' : 'x'}")
puts("nearby_az('a') == false: #{nearby_az('a') == false ? '.' : 'x'}")
@dariocravero
dariocravero / 1-switch.js
Last active August 29, 2015 14:23
playing around with redux reducers syntax
import { ADD, REMOVE, REMOVE_ALL } from './action-types';
import i from 'seamless-immutable';
export default function(state=i({}), {type, ...payload}) {
switch (type) {
case ADD: return add(state, payload);
case REMOVE: return remove(state, payload);
case REMOVE_ALL: return removeAll(state, payload);
default: return state;
}
#!/usr/bin/env bash -e
CONFIG=$1
DEST=$2
HOST='http://fontello.com/'
SESSION_ID_FILE='.sessionid'
# 1.
# POST http://fontello.com/ creates a session with your config and return you session_id. You can
# use it later to open fontello with you configuration and to automatically download your font.
$(document).ready(function () {
var questions = [{
question: "Which country has won the most World Cups?",
options: ["Germany", "Brazil", "Italy", "Argentina"],
correctAnswer: 1,
feedback: "Brazil has won the most World Cups Championships a total of 5."
}, {
question: "Which team is the richest in terms of revenue?",

Basically you need (in that order):

  • xcode
  • brew:
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
  • these brew packages:
brew install coreutils 
brew install git
import I from 'seamless-immutable';
import Route from 'houkou';
export default class Lookup {
constructor(patterns=[]) {
this.patterns = I(patterns).asObject(pattern => [pattern, new Route(pattern)]);
}
add(pattern) {
this.patterns = this.patterns.merge({[pattern]: new Route(pattern)});
@dariocravero
dariocravero / redhat-init.d-forever.sh
Created May 14, 2015 13:08
redhat's daemon init.d script to run sinopia on foreverjs
#!/bin/bash
### BEGIN INIT INFO
# Provides: /home/sinopia/app/run
# Required-Start: $remote_fs $syslog
# Required-Stop: $remote_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: forever running /home/sinopia/app/run
# Description: /home/sinopia/app/run
### END INIT INFO