Skip to content

Instantly share code, notes, and snippets.

View martinandert's full-sized avatar

Martin Andert martinandert

View GitHub Profile
@mattheworiordan
mattheworiordan / cli.rb
Created January 9, 2015 12:21
Thor with subcommands that work correctly with help
#!/usr/bin/env ruby
require 'thor'
class SubCommandBase < Thor
def self.banner(command, namespace = nil, subcommand = false)
"#{basename} #{subcommand_prefix} #{command.usage}"
end
def self.subcommand_prefix
import React from 'react';
import md5 from 'MD5';
class Avatar extends React.Component {
static propTypes = {
email: React.PropTypes.string,
size: React.PropTypes.number
}
static defaultProps = {
@mislav
mislav / html.rb
Created May 12, 2010 08:31
Pretty up HTML with Nokogiri and XSLT
require 'nokogiri'
ugly = Nokogiri::HTML ARGF
tidy = Nokogiri::XSLT File.open('tidy.xsl')
nice = tidy.transform(ugly).to_html
puts nice
@Tvaroh
Tvaroh / TransitSvc.js
Last active June 2, 2017 19:40
transit-js bridge to immutable 3.0
define(['transit', 'immutable'], function (Transit, Imm) {
'use strict';
var reader = Transit.reader('json', {
arrayBuilder: {
init: function () { return Imm.List.of().asMutable(); },
add: function (ret, val) { return ret.push(val); },
finalize: function (ret) { return ret.asImmutable(); },
fromArray: function (arr) { return Imm.List(arr); }
},
@dliggat
dliggat / mixpanel_export.rb
Last active January 14, 2017 14:41
Export data from Mixpanel
#!/usr/bin/env ruby
require 'active_support/time'
require 'digest'
API_KEY = 'YOUR KEY'
API_SECRET = 'YOUR SECRET'
args = {
'from_date' => Date.new(2014,9,1).iso8601,
@tarjei
tarjei / Modal.jsx
Created June 17, 2014 11:02
Foundation.reveal as a React.js component
/**
* @jsx React.DOM
*/
var React = require('react/addons');
/* the link component is used to navigate away from th current url. Some of it is app spesific and
therefore not included here. */
var Link = require('../components/Link.jsx');
var cx = React.addons.classSet;
var Authenticated = React.createClass({
statics: {
willTransitionTo (transition) {
if (!authenticated()) {
transition.redirect('login');
}
}
}
});