Skip to content

Instantly share code, notes, and snippets.

View dcsg's full-sized avatar
🏠
Working from home

Daniel Gomes dcsg

🏠
Working from home
View GitHub Profile
@dcsg
dcsg / another-example.php
Last active December 14, 2015 15:19
Get HTML contents into a PHP file and print it.
<?php
//will output the content of the file and Parse anything inside <?php ?> tags
include 'example-2.php';
@dcsg
dcsg / asset.php
Created November 26, 2012 01:05
phplx - Introduction to Assetic
<?php
// require 'path/to/vendor/autoload.php';
use Assetic\Asset\FileAsset;
$asset = new FileAsset('path/to/file.js');
header('Content-Type: application/javasript');
echo $asset->dump();
@dcsg
dcsg / gist:3956033
Created October 25, 2012 23:09
Allows you to delete de current branch from the git server
ssh server_ip -l root
sudo -u git_user git config --system receive.denyDeleteCurrent warn
sudo -u git_user git config --global receive.denyDeleteCurrent warn
@dcsg
dcsg / sf2cachelogs
Created October 4, 2012 00:30
Shell script to add the correct write permissions for Symfony2 Cache and Logs app directories
#!/bin/bash
#
# author: Daniel Gomes <me@danielcsgomes.com>
# twitter: @danielcgomes
# License: MIT
# Change the value of the $apacheuser to match your apache user
# This command must be run on the root of your Symfony2 project
# You should Symlink it to your /usr/bi
#
@dcsg
dcsg / .gitattributes
Created June 4, 2012 15:18
.gitignore and .gitattributes files for ASP.NET MVC projects
# Source https://help.github.com/articles/dealing-with-line-endings
# Set default behaviour, in case users don't have core.autocrlf set.
* text=auto
# Explicitly declare text files we want to always be normalized and converted
# to native line endings on checkout.
*.c text
*.h text
# Declare files that will always have CRLF line endings on checkout.
@dcsg
dcsg / gist:2589531
Created May 3, 2012 21:09
How to use node-inspector to debug Node.js
1. start the application:
NODE_ENV=local node yourApplicationName.js --debug-brk
2. change the process pid to node-inspector
sudo kill -s USR1 pid_id
3. start node-inspector
node-inspector &
@dcsg
dcsg / TruncateFilter.js
Created April 24, 2012 10:31
Truncate Filter for AngularJS v1.0
// add the filter to your application module
angular.module('yourAppName', ['filters']);
/**
* Truncate Filter
* @Param string
* @Param int, default = 10
* @Param string, default = "..."
* @return string
*/
@dcsg
dcsg / gist:2244589
Created March 29, 2012 22:52
Creating a mysql counter variable
<?php
// I am using Symfony2 with it!
// Getting the connection
$conn = $this->getDoctrine()->getConnection();
// Sets the SQL counter variable
$conn->exec("SET @I := 0");
@dcsg
dcsg / CalendarioView.mxml
Created October 8, 2011 19:18
Example of a custom Item Renderer for Flex Mobile App's
<?xml version="1.0" encoding="utf-8"?>
<s:View xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:dao="dao.*"
xmlns:local="*"
xmlns:supportClasses="spark.skins.mobile.supportClasses.*"
creationComplete="data=moduleSrv.getScheduleModules()" title="Calendário"
top="0" bottom="0" right="0" left="0">
<fx:Declarations>
<dao:ModuleDAO id="moduleSrv"/>