Skip to content

Instantly share code, notes, and snippets.

View kkuchta's full-sized avatar

Kevin Kuchta kkuchta

View GitHub Profile
<?php
require_once( 'sdk-1.5.3/sdk.class.php' );
$s3 = new AmazonS3();
// Send a text file up as a silly mime type.
$bucket = 'kkuchta-testing';
$filename = 'test.txt';
$opts = array(
'fileUpload' => '/Users/kevin/tmp/test.txt',
'contentType' => 'application/octet-stream'
{
"2010-06-19T18:25:00.000Z": {
"company": {
"longName": null,
"shortName": "AF"
},
"confirmations": [
{
"name": null,
"value": "4WCM5V"
/**
* Get the nearest fruit of each type.
*
* @return [ [fruit1X,fruit1Y], [fruit2X],[fruit2Y], ... ]
*/
getNearestFruits: function(botX,botY){
var closestFruits = [];
// Init the array
for( var type = 1; type <= get_number_of_item_types(); type++ ){
@kkuchta
kkuchta / gist:4136909
Created November 23, 2012 19:19
Simple job server
require 'sinatra'
jobs = Hash.new
get '/' do
<<-eos
Usage:<br />
&nbsp;&nbsp;/getJob/&lt;jobType&gt;<br />
&nbsp;&nbsp;/addJob/&lt;jobType&gt;/&lt;jobInfo&gt;<br />
&nbsp;&nbsp;/showJobs<br />
@kkuchta
kkuchta / gist:4759853
Created February 12, 2013 02:53
Output is: Array ( [doo] => doobar ) Array ( [doo] => doobar )
<?php
class Map{
private $contents = array();
function get( $keyArr ){
return $this->contents[ $this->hash( $keyArr ) ];
}
function put( $keyArr, $valArr ){
$this->contents[ $this->hash( $keyArr ) ] = $valArr;
}
You are receiving this email because you run at least one Ruby (MRI) application on Heroku.
Early this morning, the Ruby project announced a security vulnerability in MRI 1.8.7, 1.9.2, 1.9.3, 2.0.0. The CVE identifier is CVE-2013-4164. Rubinius and JRuby are unaffected.
We believe this is limited to a denial of service vulnerability. Any Ruby application that parses JSON from an untrusted source can potentially be made to crash with little difficulty. There is also a slim theoretical possibility of a much more serious vulnerability, an Arbitrary Code Execution. We would like to stress that there are no known Proofs of Concept and this is purely theoretical, but can not be ruled out.
In response, we have released Ruby 1.8.7p375, 1.9.2p321, 1.9.3p484 and 2.0.0p353 which closes this attack vulnerability. Please upgrade as soon as possible.
filetype off
call pathogen#infect()
call pathogen#helptags()
call pathogen#runtime_append_all_bundles()
filetype plugin on
"Turn on line numbering. Turn it off with "set nonu"
set nu

Keybase proof

I hereby claim:

  • I am kkuchta on github.
  • I am kevinkuchta (https://keybase.io/kevinkuchta) on keybase.
  • I have a public key ASCU1MeJpoPdbkS7wDSjxteWCcP_VYCFldU1N88Ors08kQo

To claim this, I am signing this object:

I'm using Rollup.js to bundle Node modules into a website. I have some code like:

import { zepto } from '../node_modules/npm-zepto/zepto/dist/zepto.js';
import { waypoints } from '../node_modules/waypoints/lib/zepto.waypoints.js';

Rollup, apparently, just concatonates imported files. What's fun is that Zepto uses the "No semicolon unless you absolutely need it" syntax style, whereas everyone else does not. So the concatonated code looks like:

class Echoer
def call(env)
request = Rack::Request.new(env)
puts '---'
puts request.body.read
return [200, {}, ['ok']]
end
end
run Echoer.new