Skip to content

Instantly share code, notes, and snippets.

@Hamcha
Hamcha / CameraTracking.cs
Created February 3, 2014 22:00
Unity3D Top down (2D) Weighed Camera
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
public class CameraTracking : MonoBehaviour
{
public struct CameraObject
{
public GameObject Object;
public float Weight;
@Hamcha
Hamcha / override.css
Last active August 29, 2015 14:01
Hamcha PHPBB style override
/* Global */
@import url(http://fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,700,400italic);
* {
color: #333;
}
#logo, .forum-image, .headerbar, .servizi img {
display: none;
@Hamcha
Hamcha / money.hs
Last active August 29, 2015 14:04
Simple and explained Haskell app which does a very simple job: Count the minimum required coins to get a specific sum
-- If you have Haskell -> ghc money.hs && ./money
module Main where
-- We use Decimal because it provides us with decent floating point arithmetic.
-- Using IEEE 754 (Float) math is bad when we're talking money!
import Data.Decimal
-- All the kinds of notes and coins we have at our disposal

Keybase proof

I hereby claim:

  • I am hamcha on github.
  • I am hamcha (https://keybase.io/hamcha) on keybase.
  • I have a public key whose fingerprint is 35DD CAF8 2452 CFA6 B102 9AF3 5486 840A F825 0D9A

To claim this, I am signing this object:

@Hamcha
Hamcha / fdr.py
Last active August 29, 2015 14:06
FastDL Done Right
#!/usr/bin/env python
# FastDL Done Right
# Edit below this
# I'm lazy and I didn't want to make prompts/cmdline stuff
# Base directory
basedir = "garrysmod"
% 0 - Not found | 1 - GG | 2 - GS
contains(_ ,_, [], _, 0).
contains(H, P, [H|_], P, 1).
contains(H, P, [H|_], Q, 2) :- P \== Q.
contains(H, P, [M|T], Q, O) :- H \== M, QQ is Q + 1, contains(H, P, T, QQ, O).
% Short version of contains/5
contains(H, P, L, O) :- contains(H, P, L, 1, O).
% Increase GG or GS depending on result

Keybase proof

I hereby claim:

  • I am Hamcha on github.
  • I am hamcha (https://keybase.io/hamcha) on keybase.
  • I have a public key whose fingerprint is 35DD CAF8 2452 CFA6 B102 9AF3 5486 840A F825 0D9A

To claim this, I am signing this object:

var randomsentence = [
"ODDIO l'ultimo tweet di vincenzo lettera :°°D",
"wat",
"afkbai",
"*cloudapp link*",
"prima o poi devo rimettere in funzione culo.co.cc",
"!shadowman",
"D: Ma.. uffa!",
":O",":°°°°°°°°°°°°",
"!quote",
@Hamcha
Hamcha / english.json
Created September 7, 2012 23:45
dartMUSH English i18n file
{
"messages" : {
"welcome" : "Welcome, you'll soon enter %NAME% (World: %WORLD%),\r\nYou'll enter as a guest, you'll need to %WHITE%LOGIN%END% to affect the world\r\n",
"assignedname" : "You've been assigned the name %NAME%",
"userlist" : "\r\nYou see %PLAYERS%",
"locationlist" : "\r\nYou can go: %DIRECTIONS%",
"unknown_go" : "Go %WHITE%where?%END%",
@Hamcha
Hamcha / gist:3766666
Created September 22, 2012 16:26
Paradise reordering
$paradise = { YOUR MEGA WORLD THING HERE }
$paradise.each do |p|
parent = p[1]["parent"]
if $paradise.has_key?(parent)
unless $paradise[parent].has_key?("childs")
$paradise[parent]["childs"] = Array.new
end
$paradise[parent]["childs"].push(p)
$paradise.delete(p)