Skip to content

Instantly share code, notes, and snippets.

import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.Screen;
import com.badlogic.gdx.graphics.GL10;
import com.badlogic.gdx.graphics.OrthographicCamera;
import com.badlogic.gdx.math.Matrix4;
import com.badlogic.gdx.math.Vector2;
import com.badlogic.gdx.physics.box2d.Body;
import com.badlogic.gdx.physics.box2d.BodyDef;
import com.badlogic.gdx.physics.box2d.BodyDef.BodyType;
import com.badlogic.gdx.physics.box2d.Box2DDebugRenderer;
@agmcleod
agmcleod / melonjsgame.js
Created January 26, 2013 17:00
Rendered JS
(function() {
Entities.Bullet = me.ObjectEntity.extend({
init: function(x, y, settings) {
this.tx = settings.tx;
this.ty = settings.ty;
settings.image = "bullets";
settings.spritewidth = 16;
settings.spriteheight = 16;
this.width = 16;
@agmcleod
agmcleod / gist:4725819
Created February 6, 2013 21:03
This would be funny to inject in a browser request.
<style type="text/css">
body {
transform:rotate(180deg);
-webkit-transform: rotate(180deg);
-moz-transform:rotate(180deg);
-ms-transform:rotate(180deg);
-o-transform:rotate(180deg);
}
</style>
(function() {
Ajax.Responders.register({
onCreate: function(request) {
var token = $$('meta[name=csrf-token]')[0];
if (token) {
if (!request.options.requestHeaders) request.options.requestHeaders = {};
request.options.requestHeaders['X-CSRF-Token'] = token.readAttribute('content');
}
}
});
var sys = require("sys"),
my_http = require("http"),
path = require("path"),
url = require("url"),
filesys = require("fs");
my_http.createServer(function(request,response){
var my_path = url.parse(request.url).pathname;
var full_path = path.join(process.cwd(),my_path);
path.exists(full_path,function(exists){
if(!exists){
@agmcleod
agmcleod / url_parser.rb
Created March 13, 2013 23:01
To run, you need ruby 1.9.2+. Pass the csv containing urls as an argument.
require 'csv'
require 'net/http'
responses = []
CSV.foreach(ARGV[0]) do |row|
responses << "#{row},#{Net::HTTP.get_response(URI.parse(row[0]))}"
puts row
end
IO.write("url_responses.csv", responses.join("\n"))
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title></title>
<meta name="viewport" content="width=device-width, minimum-scale=1.0" />
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
</head>
<body>
</body>
@agmcleod
agmcleod / trickshots.md
Created June 26, 2013 14:33
Ruby trickshots

Ruby trickshots

irb: rand(10..30) # create a random between a range

$ gem install awesome_print
irb: require 'ap'; ap [0,1,2]

x = 'string'; x['st'] # => 'st'

include A, B, C # include multiple modules in one line

@agmcleod
agmcleod / gist:6125657
Created July 31, 2013 20:05
array testing
require 'benchmark'
arr = [
]
Benchmark.bm do |x|
x.report 'class check' do
100.times.each do |i|
100_000.times.each do |j|
ig.module(
'plugins.touch-button'
)
.requires(
'impact.system',
'impact.input',
'impact.image'
)
.defines(function(){