Skip to content

Instantly share code, notes, and snippets.

@empika
empika / OnConfirmCancel
Last active August 29, 2015 14:05
Add Confirm and cancel handling to a Unity UI element
using System;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using UnityEngine.EventSystems;
[Serializable]
public class ConfirmCancelEntry
{
@empika
empika / OnConfirmCancelEditor
Created August 30, 2014 16:24
Editor extension for OnConfirmCancel
using System;
using UnityEngine;
using UnityEngine.EventSystems;
using UnityEditor;
[CustomEditor (typeof(OnConfirmCancel), true)]
public class OnConfirmCancelEditor : Editor
{
//
// Fields
@empika
empika / gist:b3d7c9a8b3db9aa3ee9c
Created September 16, 2014 18:18
Normal mapped transparent sprites with shadows
Shader "JM/Sprite Bumped Shadows" {
Properties {
_Color ("Main Color", Color) = (1,1,1,1)
[PerRendererData] _MainTex ("Base (RGB) Trans (A)", 2D) = "white" {}
_BumpMap ("Normalmap", 2D) = "bump" {}
_Cutoff ("Alpha cutoff", Range(0,1)) = 0.5
[MaterialToggle] PixelSnap ("Pixel snap", Float) = 0
}
SubShader {
@empika
empika / gist:10e703989ffecfa89a98
Last active August 29, 2015 14:16
Load an array of sprites in unity
string spriteSheet = AssetDatabase.GetAssetPath( TileMapTexture );
Sprite[] sprites = AssetDatabase.LoadAllAssetsAtPath(spriteSheet).OfType<Sprite>().ToArray();
>> feed.search_bundles
SyntaxError: /Users/eddy/Documents/Projects/Rails/buzzminotaur_0.3/app/models/search_bundle.rb:132: syntax error, unexpected $end, expecting kEND
from /Users/eddy/.gem/ruby/1.8/gems/activesupport-2.3.3/lib/active_support/dependencies.rb:380:in `load_without_new_constant_marking'
from /Users/eddy/.gem/ruby/1.8/gems/activesupport-2.3.3/lib/active_support/dependencies.rb:380:in `load_file'
from /Users/eddy/.gem/ruby/1.8/gems/activesupport-2.3.3/lib/active_support/dependencies.rb:521:in `new_constants_in'
from /Users/eddy/.gem/ruby/1.8/gems/activesupport-2.3.3/lib/active_support/dependencies.rb:379:in `load_file'
from /Users/eddy/.gem/ruby/1.8/gems/activesupport-2.3.3/lib/active_support/dependencies.rb:259:in `require_or_load'
from /Users/eddy/.gem/ruby/1.8/gems/activesupport-2.3.3/lib/active_support/dependencies.rb:425:in `load_missing_constant'
from /Users/eddy/.gem/ruby/1.8/gems/activesupport-2.3.3/lib/active_support/dependencies.rb
raw_config = File.read(RAILS_ROOT + "/config/twitter_config.yml")
TWITTER_CONFIG = YAML.load(raw_config)[RAILS_ENV].symbolize_keys
$(".tweet_actions").each(function(ta){
$(this).children().each(function(child){
// cannot call this attach_actions function
attach_actions(this);
});
});
var attach_actions = function(){
console.log("attached action");
}
def self.fetch_yams
config_path = File.join(RAILS_ROOT, 'config', 'yammer.yml')
yammer = Yammer::Client.new(:config => config_path)
# this is the ID of the main link hashtag (should be 402387)
link_tag_id = 0
tags = yammer.tags
tags.each do |tag|
if( tag.name == "link")
link_tag_id = tag.id
require 'tlsmail'
Net::SMTP.enable_tls(OpenSSL::SSL::VERIFY_NONE)
ActionMailer::Base.raise_delivery_errors = true
ActionMailer::Base.perform_deliveries = true
ActionMailer::Base.smtp_settings = {
:address => "smtp.gmail.com",
:port => 587,
:domain => "mydomain.co.uk",
:user_name => "e@mydomain.co.uk",
:password => "password",
# How to set up your local development machine to use the Apigee Heroku addon
if ENV['APIGEE_TWITTER_API_ENDPOINT']
@@twitter_api = ENV['APIGEE_TWITTER_API_ENDPOINT']
else
# Get this value from Heroku.
# Once you have enabled the addon, boot up the 'heroku console' and run the following:
# puts ENV['APIGEE_TWITTER_API_ENDPOINT']
# this will spit out your correct api endpoint
@@twitter_api = "twitter-api.appXYZABC.apigee.com"