Skip to content

Instantly share code, notes, and snippets.

View smeevil's full-sized avatar
🥰
Hugs for all!

Gerard de Brieder smeevil

🥰
Hugs for all!
  • Govannon
  • Netherlands
View GitHub Profile
#!/usr/bin/ruby
@exec="red5.sh"
@name="Red 5"
@match="/var/red5/boot.jar"
@kill_sig="-9"
@sleep=5
@pidfile=File.expand_path(File.join(File.dirname(__FILE__), "pid", "#{@exec}.pid"))
@path=File.expand_path(File.join(File.dirname(__FILE__)))
@smeevil
smeevil / allow_single_access.rb
Created February 8, 2010 13:56
authlogic single_access_allowed config
# Allows you to define "allow_single_access" in multiple ways :
#
# single_access_allowed #all methods are accessable
# single_access_allowed :only=>:index
# single_access_allowed :only=>[:index, :show]
# single_access_allowed :except=>[:edit]
# single_access_allowed :except=>[:edit, :delete]
#
### example
@smeevil
smeevil / gist:2875769
Created June 5, 2012 15:37
Cookie control translation
//Add this after your cookie control script
function TranslateCookieControl(){
var cookieControlTitle="Cookie Acceptatie";
var cookieControlOkButton="Ik ga hiermee akkoord !";
var cookieControlMoreInfoButton="Meer info"
var cookieControlLessInfoButton="Minder info"
$('p.ccc-about').remove();
$('#ccc-go').html(cookieControlOkButton);
$('.ccc-inner').children().first().html(cookieControlTitle);
@smeevil
smeevil / notify_flowdock
Created July 24, 2013 11:07
Just add this as last line to your Deploy commands on semaphore app. A simple notification to the deployer that semaphore app's deploy is done. Just replace <API_KEY> with the api key of your flow dock channel. If your first name of the commit is the same as your name in flow dock, you will get a notification beep :)
NAME=`git --no-pager show -s --format='%cn' $REVISION|sed -e 's/ .*//'` && curl -X POST --data "{\"content\": \"Deploy by @$NAME is done #deploy\", \"external_user_name\": \"Semaphore\", \"tags\": [\"deploy\"]}" https://api.flowdock.com/v1/messages/<API_KEY> --header "Content-Type:application/json"
### Keybase proof
I hereby claim:
* I am smeevil on github.
* I am smeevil (https://keybase.io/smeevil) on keybase.
* I have a public key whose fingerprint is 7873 DAFA 55BF 1BA5 C258 229D 1FD5 EFA3 4596 87B5
To claim this, I am signing this object:
Template.chatLine.helpers
username: ->
username = userIdsToUserNames[@userId]
return username if username
console.log "searching for id #{@userId}"
user = Meteor.users.findOne(_id: @userId)
if user?
userIdsToUserNames[@userId] = user.username
return user.username
else
@smeevil
smeevil / gist:4f9be1d21003fdb5c464
Last active August 29, 2015 14:15
shared function
Template.foo.rendered = ->
@_mySharedFunction = ->
console.log "yeah baby"
Template.foo.events
'click .something': (e, template)->
template._mySharedFunction()
Template.foo.helpers
myHelper: ->
@smeevil
smeevil / irccloud-toggle
Last active August 29, 2015 14:15
Toggle irccloud cruft
// ==UserScript==
// @name Minimal Irc Cloud
// @namespace http://govannon.nl/
// @version 0.1
// @description Add a button to toggle minimal mode for irc cloud
// @author Smeevil
// @match https://www.irccloud.com
// @grant none
// ==/UserScript==
setTimeout(function() {
str="You shall not not pass"
if str == "Somehow it does" || "But why is that?"
console.log "I passed with no problems ??"
str="You shall not not pass"
if str == ("I cannot pass anymore" || "Me either")
console.log "This indeed never happens"
@smeevil
smeevil / gist:b235969299cac4d2eb56
Last active August 29, 2015 14:23
Unity Get Angle of Transform to Self
public static float GetAngleOfTransformToSelf(Transform other, Transform origin, bool debug) {
var angle = (Math.Atan2(other.position.z - origin.position.z, other.position.x - origin.position.x)*Mathf.Rad2Deg);
angle += origin.rotation.eulerAngles.y;
angle -= 90;
while (angle > 180) angle -= 360;
if (!debug) return (float) angle;
Debug.Log(string.Format("angle orgin {0} to {1} : {2}", origin, other, angle), origin);
Debug.DrawLine(origin.position, other.position, Color.white, 1.0f);
return (float)angle;