Skip to content

Instantly share code, notes, and snippets.

@gabrielstuff
gabrielstuff / wp-config.php
Created October 8, 2013 15:53
A basic wp-config file for playing with appfog
<?php
require_once(ABSPATH . 'auth.php');
$services = getenv("VCAP_SERVICES");
if($services != ""){
$services_json = json_decode($services,true);
$mysql_config = $services_json["mysql-5.1"][0]["credentials"];
// ** MySQL settings from resource descriptor ** //
define('DB_NAME', $mysql_config["name"]);
@gabrielstuff
gabrielstuff / fadeOut.cs
Created August 27, 2013 23:39
Simple FadeOut
void fadeOut(float duration, float delay){
_duration = duration;
_delay = delay;
Color colorTo = renderer.material.color;
colorTo.a = 0;
foreach (Material mat in renderer.materials)
{
HOTween.To(mat, duration, new TweenParms()
.Prop("color", colorTo)
.Ease(EaseType.EaseInOutQuad) // Ease
@gabrielstuff
gabrielstuff / SpawnStars.cs
Created August 26, 2013 22:08
Spawning particles around x,y on a particular Z plan
using TouchScript.Gestures;
using UnityEngine;
using System.Collections;
public class SpawnSparkle : MonoBehaviour
{
public Transform Container;
public GameObject ParticlePrefab;
[Range(0.0f, 100)]
@gabrielstuff
gabrielstuff / betterRound.js
Created August 24, 2013 21:08
Round function with float approximation. Very basic but useful. Usage : betterRound(number, approximate);
function betterRound(number, roundness){
if(roundness === undefined){
roundness = 0;
}
var round = Math.pow(10, roundness);
return Math.ceil(number * round) / round;
}
@gabrielstuff
gabrielstuff / gist:5863179
Created June 25, 2013 22:51
CORS server side
Access-Control-Allow-Methods: GET, POST
Access-Control-Allow-Credentials: true
Access-Control-Allow-Origin: http://origin.foo
Access-Control-Allow-Headers: Content-Type, *
@gabrielstuff
gabrielstuff / express.js
Last active August 27, 2023 05:33
express + passport + session / req.session
/**
* Module dependencies.
*/
var express = require('express'),
mongoStore = require('connect-mongo')(express),
flash = require('connect-flash'),
viewHelpers = require('./middlewares/view'),
fs = require('fs'),
upload = require('jquery-file-upload-middleware');
@gabrielstuff
gabrielstuff / jquery.mask.js
Created May 17, 2013 23:00
Using jquery to make a masked element draggable.
/*from http://css-tricks.com/snippets/jquery/draggable-without-jquery-ui/
Added compatibility with iOS touch devices
HTML should be something like :
<div class="container">
<img id="image1" class="erb-image-wrapper" src="test.jpg"> <!-- this is your masked element -->
<img id="image2" class="erb-image-wrapper" src="femme.png" style="cursor: move;"> <!-- this is your mask over the masked element-->
</div>
*/
@gabrielstuff
gabrielstuff / controllers_config.js
Last active December 17, 2015 08:19
An error with my request
var mongoose = require('mongoose'),
Config = mongoose.model('Config')
exports.create = function(req, res) {
debugger;
var conf = new Config(req.body);
conf.save(function(err) {
if (err) throw new Error('Error while saving option');
console.log("Ouray !");
@gabrielstuff
gabrielstuff / screen.json
Last active December 16, 2015 13:39
screen description
{
"screens": [
{
"crop_height": 600,
"crop_width": 800,
"margin_left": 200,
"margin_top": 200,
"name": "screen1",
"pi": "45"
},