Skip to content

Instantly share code, notes, and snippets.

View tracend's full-sized avatar
🎯
Focusing

✌ Makis Tracend tracend

🎯
Focusing
View GitHub Profile
@tracend
tracend / AvoidObject.js
Created March 30, 2011 00:20
Unity3D: Raycast object avoidance - Source: http://wiki.dreamsteep.com/Unity_ai
var target : Transform;
function Update(){
//the direction vector to target
var dir = (target.position - transform.position).normalized;
var hit :RaycastHit;
if (Physics.Raycast(transform.position,transform.forward,hit ,20)){
//no self collision
if(hit.transform !=transform)
@tracend
tracend / aws_ec2_root.md
Created November 5, 2012 12:02
AWS EC2: Steps to enable root access with your local key - Inspired by: https://forums.aws.amazon.com/thread.jspa?threadID=86876

Note: replace {{server}} with your domain or ip

  • Login as the ec2-user
ssh -i key.pem ec2-user@{{server}}
  • Switch to administrator
sudo -i
<?php
$host = 'localhost'; // MYSQL database host adress
$db = ''; // MYSQL database name
$user = ''; // Mysql Datbase user
$pass = ''; // Mysql Datbase password
// Connect to the database
$link = mysql_connect($host, $user, $pass);
mysql_select_db($db);
@tracend
tracend / backbone.session.js
Last active January 24, 2019 00:06
[DEPRECATED] Uniform session support for Backbone.js apps Project moved: http://github.com/makesites/backbone-session
/*
* Backbone Session
* Source: https://github.com/makesites/backbone-session
* Copyright © Makesites.org
*
* Initiated by Makis Tracend (@tracend)
* Distributed through [Makesites.org](http://makesites.org)
* Released under the [MIT license](http://makesites.org/licenses/MIT)
*/
@tracend
tracend / handlebars.localisation.js
Last active October 16, 2018 18:11
Handlebars Localisation Helper #cc
// Handlebars Localisation Helper
// Source: https://gist.github.com/tracend/3261055
Handlebars.registerHelper('l10n', function(keyword) {
var lang = (navigator.language) ? navigator.language : navigator.userLanguage;
// pick the right dictionary (if only one available assume it's the right one...)
var locale = window.locale[lang] || window.locale['en-US'] || window.locale || false;
// exit now if there's no data
if( !locale ) return target;
@tracend
tracend / cdn.sh
Last active August 12, 2018 15:33
Shell cheat sheet
# compress a file
gzip -9 [filename]
# get the file headers of a url
curl -I [url]
@tracend
tracend / fb-user-liked-page.js
Created April 20, 2011 02:29
Facebook JS-SDK: Check if the user has liked a page
FB.api({ method: 'pages.isFan', page_id: '{PAGE_ID}' }, function(response) {
if (response) {
alert("user has liked the page");
} else {
alert("user has not liked the page");
}
});
@tracend
tracend / .htaccess
Created April 2, 2011 07:19
Wordpress: Almost Perfect htaccess File for WordPress blogs - Source: http://www.josiahcole.com/2007/07/11/almost-perfect-htaccess-file-for-wordpress-blogs/
# protect the htaccess file
<files .htaccess>
order allow,deny
deny from all
</files>
# disable the server signature
ServerSignature Off
# limit file uploads to 10mb
@tracend
tracend / makesites-insider-201608.md
Last active January 4, 2018 02:00
The Everlasting Code #makesites #insider

The Everlasting Code

Every line's been accounted for and tested… The community has voted with their applications and contributions… When all's said and done, there's a piece of software left, a monument, testament to the effort and ability put into creating a working solution. Now, lets make sure it stays relevant and delay the inevitability of becoming a relic of the past.


There are probably very few sayings more saturated than: "Sharing is caring". Yet, collaborative development is proven to generate better results. The more eyes look at the source the better the chances of improving it to create a better solution. This doesn't change after the core work is finished.

Forbidden & Forgotten

@tracend
tracend / handlebars.contains.js
Created January 30, 2014 06:08
Handlebars helper: Contains
// Handlebars helper: Contains
// check if a value is contained in an array
Handlebars.registerHelper("contains", function( value, array, options ){
// fallback...
array = ( array instanceof Array ) ? array : [array];
return (array.indexOf(value) > -1) ? options.fn( this ) : "";
});