Skip to content

Instantly share code, notes, and snippets.

View Splat's full-sized avatar

Ryan Donahue Splat

  • Earth
View GitHub Profile
@Splat
Splat / nodejs_fedora_install.md
Last active July 8, 2016 21:10
Nodejs install on Fedora

Installation of NodeJS in Fedora

I recently had a bit of trouble installing nodejs on my Fedora installation. RPM was having issues installing during the nodejs install process.

The error installing as root is as follows:

+ rpm -i --nosignature --force '/tmp/tmp.3BlR6h6inY'
*error: can't create transaction lock on /var/lib/rpm/.rpm.lock (Inappropriate ioctl for device)*
Error executing command, exiting
# Description goes here!
#
# * *Params* :
# - ++ ->
# * *Headers* :
# - ++ ->
# * *Body* :
# - ++ ->
# * *Args* :
# - ++ ->
# 9 out of 10 microbenchmarks agree: implicit return smokes explicit return
require 'benchmark'
def explicit
return 1
end
def implicit
1
end
@Splat
Splat / s3.sh
Last active August 29, 2015 14:20 — forked from chrismdp/s3.sh
# You don't need Fog in Ruby or some other library to upload to S3 -- shell works perfectly fine
# This is how I upload my new Sol Trader builds (http://soltrader.net)
# Based on a modified script from here: http://tmont.com/blargh/2014/1/uploading-to-s3-in-bash
S3KEY="my aws key"
S3SECRET="my aws secret" # pass these in
function putS3
{
path=$1
@Splat
Splat / Mongo-River-Elasticsearch-Init
Created February 4, 2015 21:31
Initialization of mongo using to elasticsearch
sudo apt-get update
sudo apt-get install openjdk-6-jre-headless -f
sudo apt-get install curl
sudo apt-get install unzip
sudo apt-get install openssh-server
sudo curl -OL http://github.com/downloads/elasticsearch/elasticsearch/elasticsearch-0.19.8.zip
sudo unzip elasticsearch-* && rm elasticsearch-*.zip
cd elasticsearch-0.19.8
sudo mkdir /usr/local/elasticsearch
@Splat
Splat / escapist.js
Created August 29, 2014 14:11
quick and dirty regex replacement for html and xml encoding.
function Escapist() {
}
// escapeXml escapes XML, but not HTML because HTML does not know & apos;.
// However most browsers also support & apos; in HTML documents.IE is not most browsers.
Escapist.prototype.escapeHTML = function (str) {
var htmlCharMap = {
'<': '&lt;',
'>': '&gt;',
@Splat
Splat / AppDelegate
Created July 17, 2014 15:22
Cloudmine example of an application using push notifications from a shared application with multiple data stores, IDs and Keys.
//
// AppDelegate.m
// CarsGalore
//
// Copyright (c) 2014 Cloudmine. All rights reserved.
//
// This is a sample application which shows how to have users and data
// in one app but push notifications are coming from a shared app that
// is responsible for sending multiple applications notifications.
@Splat
Splat / gist:c5ac481c004400b1c435
Last active August 29, 2015 14:04
Cloudmine example of an application using push notifications from a shared application with multiple data stores, IDs and Keys.
//
// AppDelegate.m
// CarsGalore
//
// Copyright (c) 2014 Cloudmine. All rights reserved.
//
// This is a sample application which shows how to have users and data
// in one app but push notifications are coming from a shared app that
// is responsible for sending multiple applications notifications.
@Splat
Splat / activity-alertview
Created September 17, 2013 13:28
Given iOS7 no longer recommends or renders added subviews to the screen... And given that many people added activity indicators to alert view to block the applications main thread while blocking operations are ongoing... This takes an alert message and displays the message along with marching ants to indicate something is going on.
NSTimer timer;
UIAlertView alertView = new UIAlertView ("test", "Testing the animation\n ", null, null, new string[] {});
alertView.Presented += (object sender, EventArgs e) => {
using (var pool = new NSAutoreleasePool())
{
timer = NSTimer.CreateRepeatingScheduledTimer(1, delegate {
if (alertView.Message.EndsWith("..."))
{
string newMessage;
newMessage = alertView.Message.Remove (alertView.Message.Length - 3);
@Splat
Splat / monotouch_image_normalization
Last active December 17, 2015 02:19
Monotouch normalize image to orientation for shipping to external applications | servers which may not respect the EXIF data.
public static UIImage RotateImage (this UIImage image)
{
if (image.Orientation == UIImageOrientation.Up) return image;
UIGraphics.BeginImageContextWithOptions(image.Size, false, image.CurrentScale);
iimage.DrawAsPatternInRect(new RectangleF(0, 0, image.Size.Width, image.Size.Height));
UIImage normalizedImage = UIGraphics.GetImageFromCurrentImageContext();
UIGraphics.EndImageContext();
return normalizedImage;
}