Skip to content

Instantly share code, notes, and snippets.

View victusfate's full-sized avatar
🚀

Mark Essel victusfate

🚀
View GitHub Profile
- (void)uploadImage:(UIImage *)image
completionHandler:(void (^)(NSDictionary *uploadResponse, NSError *error))completionHandler {
[[UIApplication sharedApplication] setNetworkActivityIndicatorVisible:YES];
[self get:[self uploadURL] completionHandler:^(id responseData, NSError *error) {
if (error) {
completionHandler(nil, error);
} else if (!responseData) {
completionHandler(nil, [NSError errorWithDomain:@"Upload Failed" code:500 userInfo:nil]);
} else {
NSDictionary *response = (NSDictionary *)responseData;
import Foundation
import Alamofire
public enum Router:URLRequestConvertible {
public static let baseUrlString:String = "http://testapi.example.com"
case Upload(fieldName: String, fileName: String, mimeType: String, fileContents: NSData, boundaryConstant:String);
var method: Alamofire.Method {
switch self {
case Upload:
// #!/usr/bin/env swift
// If you want to run this file from the command line uncomment the above line
// so that the '#' symbol is at the beginning of the line.
// Created by Kevin Meaney on 20/11/2014.
// Copyright (c) 2014 Kevin Meaney. All rights reserved.
// The first part of the script is basically config options.
import Cocoa
import AVFoundation
//Add text to UIImage
-(UIImage *)addText:(UIImage *)img text:(NSString *)text1{
int w = img.size.width;
int h = img.size.height;
//lon = h - lon;
CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB();
CGContextRef context = CGBitmapContextCreate(NULL, w, h, 8, 4 * w, colorSpace, kCGImageAlphaPremultipliedFirst);
CGContextDrawImage(context, CGRectMake(0, 0, w, h), img.CGImage);
CGContextSetRGBFillColor(context, 0.0, 0.0, 1.0, 1);
<html>
<head>
<title></title>
<style type="text/css">
body,html{
background-color: hsl(0,0%,10%);
margin:0px;
padding: 0px;
}
canvas{
// simple fragment shader
// 'time' contains seconds since the program was linked.
uniform float time;
uniform sampler2D tex;
uniform sampler2D tex2;
float radius = .5;
curl -s https://api.github.com/orgs/<organization>/repos?per_page=200 | ruby -rubygems -e 'require "json"; JSON.load(STDIN.read).each { |repo| %x[git clone #{repo["ssh_url"]} ]}'
#!/bin/bash
set -o errexit
# Author: David Underhill
# Script to permanently delete files/folders from your git repository. To use
# it, cd to your repository's root and then run the script with a list of paths
# you want to delete, e.g., git-delete-history path1 path2
#
# retrieved from: http://dound.com/2009/04/git-forever-remove-files-or-folders-from-history/
#
#include <cmath>
#include <assert.h>
#include <core/TestPattern.h>
TestPattern::TestPattern()
:w(0)
,h(0)
,frame_num(0)
,duration(0)
@victusfate
victusfate / 0_reuse_code.js
Created March 7, 2014 16:23
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console