Skip to content

Instantly share code, notes, and snippets.

@jgv
jgv / gist:2968919
Created June 21, 2012 22:15
my save method
- (void)save {
UIImage *bgImage = editView.image;
//UIImage *fgImage = yoloView.image;
// a rect that has has the transformation from the yoloview applied to it
CGRect rect = CGRectApplyAffineTransform([yoloView frame], [yoloView transform]);
// the rect we are manipulating
//CGRect rect = CGRectMake(0, 0, yoloView.size.width, yoloView.image.size.height);
UIImage *image = [info objectForKey:UIImagePickerControllerOriginalImage];
//imageView.image = image;
int w = image.size.height;
int h = image.size.width;
CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB();
CGContextRef context = CGBitmapContextCreate(NULL, w, h, 8, 4 * w, colorSpace, kCGImageAlphaPremultipliedFirst);
CGContextDrawImage(context, CGRectMake(0, 0, w, h), image.CGImage);
@jgv
jgv / bot.pl
Created June 8, 2012 17:34
automemebot
#/usr/bin/perl
use strict;
use warnings;
use Net::OSCAR qw(:standard);
use LWP::Simple;
use Proc::Daemon;
# Daemonize
Proc::Daemon::Init();
print 'daemonizing';
* {
-moz-box-sizing: border-box;
-webkit-box-sizing: border-box;
box-sizing: border-box;
}
#tools {
list-style: none;
margin: 4px 0px 0px 10px;
padding: 0;
@jgv
jgv / send-image.js
Created May 24, 2012 20:01
send image data across domains
var canvas = document.getElementById("canvas"),
image = canvas.toDataURL("image/png");
$.ajax({
url: "https://app-engine-identifier.appspot.com/upload",
type: "POST",
data: { imgdata : image },
crossDomain: true,
success: function(data){
console.log(data); // yayyy
@jgv
jgv / main.py
Last active March 27, 2017 03:31
write a base64 encoded image to an app engine blob store
#!/usr/bin/env python
#
from __future__ import with_statement
import os, urllib2, re, base64
from google.appengine.api import users, images, files
from google.appengine.ext import blobstore, db, webapp
from google.appengine.ext.webapp import blobstore_handlers
from google.appengine.ext.webapp.util import run_wsgi_app
<div id="infobox" class="bbox white padding inlineblock">
.white {
background-color:white;
border:1px solid #afafaf;
}
.inlineblock {
display:inline-block;
}
.bbox {
-moz-box-shadow: -1px 1px #000,-2px 2px #000,-3px 3px #000;
-webkit-box-shadow: -1px 1px #000,-2px 2px #000,-3px 3px #000;
<?xml version="1.0" encoding="UTF-8" ?>
<Module>
<ModulePrefs title="Starter App">
<Require feature="rpc"/>
</ModulePrefs>
<Content type="html"><![CDATA[
<!DOCTYPE html>
<script src="//hangoutsapi.talkgadget.google.com/hangouts/api/hangout.js?v=1.1"></script>
<!-- // production
# a test version of the app.yaml used for development. This is not intended to be checked in
application: your-application-identifier
version: 1
runtime: python27
api_version: 1
threadsafe: false
# Set cache duration to 0 for development
default_expiration: "0m"