Skip to content

Instantly share code, notes, and snippets.

View superic's full-sized avatar

Eric Willis superic

  • San Francisco
  • 00:39 (UTC -07:00)
View GitHub Profile
A
ABA
ABCBA
ABCDCBA
ABCDEDCBA
ABCDEFEDCBA
ABCDEFGFEDCBA
ABCDEFGHGFEDCBA
ABCDEFGHIHGFEDCBA
ABCDEFGHIJIHGFEDCBA
@superic
superic / keybase.md
Created September 6, 2016 01:11
keybase.md

Keybase proof

I hereby claim:

  • I am superic on github.
  • I am superic (https://keybase.io/superic) on keybase.
  • I have a public key whose fingerprint is 32BD 33BA E417 7E95 50AB CA66 7E98 718A F158 D7C1

To claim this, I am signing this object:

Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@superic
superic / interactive.php
Last active January 3, 2016 10:09
Interactive command line PHP with STDIN and STDOUT
<?php
$input = 'foo';
while(!empty($input)) {
fwrite(STDOUT, "Enter something: ");
$input = trim(fgets(STDIN));
fwrite(STDOUT, "\nYou entered: $input\n");
}
@superic
superic / invoke.php
Created January 6, 2014 22:10
Call PHP anonymous function that is an object property. More information: http://eric.tumblr.com/post/72481137519/call-php-closure-that-is-an-object-property
$person = (object) array(
"name" => "Eric",
"location" => "SF",
"sayHello" => function () {
return "Hello!";
}
);
// does not work with anonymous functions in PHP
var_dump($person->sayHello());
private static Bitmap Blur(Bitmap image, Rectangle rectangle, Int32 blurSize)
{
Bitmap blurred = new Bitmap(image.Width, image.Height);
// make an exact copy of the bitmap provided
using(Graphics graphics = Graphics.FromImage(blurred))
graphics.DrawImage(image, new Rectangle(0, 0, image.Width, image.Height),
new Rectangle(0, 0, image.Width, image.Height), GraphicsUnit.Pixel);
// look at every pixel in the blur rectangle
private static Bitmap Pixelate(Bitmap image, Rectangle rectangle, Int32 pixelateSize)
{
Bitmap pixelated = new System.Drawing.Bitmap(image.Width, image.Height);
// make an exact copy of the bitmap provided
using (Graphics graphics = System.Drawing.Graphics.FromImage(pixelated))
graphics.DrawImage(image, new System.Drawing.Rectangle(0, 0, image.Width, image.Height),
new Rectangle(0, 0, image.Width, image.Height), GraphicsUnit.Pixel);
// look at every pixel in the rectangle while making sure we're within the image bounds
@superic
superic / BlackAndWhite.cs
Created December 28, 2013 23:37
Make an image black and white in c#. For more information: http://eric.tumblr.com/post/71459461047/make-an-image-black-and-white-in-c
private static Bitmap BlackAndWhite(Bitmap image, Rectangle rectangle)
{
Bitmap blackAndWhite = new System.Drawing.Bitmap(image.Width, image.Height);
// make an exact copy of the bitmap provided
using(Graphics graphics = System.Drawing.Graphics.FromImage(blackAndWhite))
graphics.DrawImage(image, new System.Drawing.Rectangle(0, 0, image.Width, image.Height),
new Rectangle(0, 0, image.Width, image.Height), GraphicsUnit.Pixel);
// for every pixel in the rectangle region
using System;
using System.Web.Mvc;
using System.Text;
namespace Web.Extensions
{
public static class HtmlHelperExtensions
{
#region Private Statics
@superic
superic / test.html
Created February 21, 2012 05:01
Test
<div id="test">just testing</div>