Skip to content

Instantly share code, notes, and snippets.

View martinandert's full-sized avatar

Martin Andert martinandert

View GitHub Profile
@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
@dylanjha
dylanjha / 0. sprockets_depend_on_config.rb
Last active May 11, 2020 15:11
Adds Sprockets Directive `depend_on_config`. I'm using this to load .yml locale translations on the server into the client in json
=begin
Useage:
#assets/locales/en.js.erb
```js
//= depend_on_config 'locales/es.yml'
```
=end
@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;
@xdamman
xdamman / install_ffmpeg_ubuntu.sh
Created July 2, 2014 21:03
Install latest ffmpeg on ubuntu 12.04 or 14.04
#!/bin/bash
# Bash script to install latest version of ffmpeg and its dependencies on Ubuntu 12.04 or 14.04
# Inspired from https://gist.github.com/faleev/3435377
# Remove any existing packages:
sudo apt-get -y remove ffmpeg x264 libav-tools libvpx-dev libx264-dev
# Get the dependencies (Ubuntu Server or headless users):
sudo apt-get update
@sebmarkbage
sebmarkbage / ReactCanvasDrawing.js
Created July 25, 2014 19:14
Canvas Drawing Example
/** @jsx React.DOM */
var Graphic = React.createClass({
componentDidMount: function() {
var context = this.getDOMNode().getContext('2d');
this.paint(context);
},
componentDidUpdate: function() {
@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,
@renancouto
renancouto / exploit-urls.md
Last active February 1, 2023 09:36
A collection of weird URLs that I think are used to exploit security vulnerabilities on web apps
  • /manager/html (Apache Tomcat)
  • http://123.249.24.233/POST_ip_port.php
  • /tmUnblock.cgi
  • /HNAP1/
  • /phpMyAdmin/scripts/setup.php (PHPMyAdmin)
  • /pma/scripts/setup.php
  • /myadmin/scripts/setup.php
  • /MyAdmin/scripts/setup.php
  • /vyvy/vyv/vy.php
  • /cgi-sys/php5
var Authenticated = React.createClass({
statics: {
willTransitionTo (transition) {
if (!authenticated()) {
transition.redirect('login');
}
}
}
});
@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