Skip to content

Instantly share code, notes, and snippets.

View Narven's full-sized avatar
👾
Walking to the fridge...

P Ξ D R O L U Z Narven

👾
Walking to the fridge...
View GitHub Profile
<?php
/**
* Controller is the customized base controller class.
* All controller classes for this application should extend from this base class.
*/
class RestController extends CController
{
/**
* @var string the default layout for the controller view. Defaults to '//layouts/column1',
* meaning using a single column layout. See 'protected/views/layouts/column1.php'.
#define DEBUG_CONSOLE
#define DEBUG_LEVEL_LOG
#define DEBUG_LEVEL_WARN
#define DEBUG_LEVEL_ERROR
#if (UNITY_EDITOR || DEVELOPMENT_BUILD)
#define DEBUG
#endif
#if (UNITY_IOS || UNITY_ANDROID)
@Narven
Narven / unity3d_scrolling_texture
Created May 7, 2014 07:34
Unity3d javascript scrolling texture
var scrollSpeed = 0.90;
var scrollSpeed2 = 0.90;
function FixedUpdate()
{
var offset = Time.time * scrollSpeed;
/*
* Copyright (c) 2013 Calvin Rien
*
* Based on the JSON parser by Patrick van Bergen
* http://techblog.procurios.nl/k/618/news/view/14605/14863/How-do-I-write-my-own-parser-for-JSON.html
*
* Simplified it so that it doesn't throw exceptions
* and can be used in Unity iPhone with maximum code stripping.
*
* Permission is hereby granted, free of charge, to any person obtaining
@Narven
Narven / gist:0e3c355f5ae675c2a352
Created May 13, 2014 11:59
Unity 3D C# script for continuous rotation
using UnityEngine;
using System.Collections;
// Continous rotation with some parameters
public class Rotation : MonoBehaviour
{
public enum RotationAxis
{
All,
@Narven
Narven / gist:2b37ad3b657d14798906
Created May 28, 2014 09:11
Composer Configurarion for Symfony 2
{
"name": "symfony/framework-standard-edition",
"license": "MIT",
"type": "project",
"description": "The \"Symfony Standard Edition\" distribution",
"autoload": {
"psr-0": { "": "src/" }
},
"require": {
"php": ">=5.3.3",
<?php
$qs = Doctrine_Query::create()
->from('MyTable1 m')
->leftJoin('m.MyTable2 p');
$res = $qs->execute();
$qs->free();
<?php
$str = '13++56-461.79/27--14-abc';
$filter = filter_var($str,FILTER_SANITIZE_NUMBER_INT);
$onlyDigitsFilterVar = str_replace(array('+', '-'), '', $filter);
$onlyDigitsRegexp1 = preg_replace('/[^\d]/', '', $str);
$onlyDigitsRegexp2 = preg_replace('/[^[:digit:]]/', '', $str); // http://www.php.net/manual/en/regexp.reference.character-classes.php
var_dump($filter); // string(19) "13++56-4617927--14-"
<?php
$q = Doctrine_Query::create()
->select('a.title as title')
->from('Article a')
->where('a.id = ?', $this->getId());
->fetchOne()->title;
$ curl -u user:pass -d status='Hello from shell' http://twitter.com/statuses/update.xml