As a freelancer, I build a lot of web sites. That's a lot of code changes to track. Thankfully, a Git-enabled workflow with proper branching makes short work of project tracking. I can easily see development features in branches as well as a snapshot of the sites' production code. A nice addition to that workflow is that ability to use Git to push updates to any of the various sites I work on while committing changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
set -e | |
vendor/bin/phpunit | |
npm run prod | |
git add . | |
(git commit -m "Build frontend assets for deployment to production") || true | |
(git push) || true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using UnityEngine; | |
public class DistanceJoint3D : MonoBehaviour { | |
public Transform ConnectedRigidbody; | |
public bool DetermineDistanceOnStart = true; | |
public float Distance; | |
public float Spring = 0.1f; | |
public float Damper = 5f; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
cecho() { | |
declare -A colors | |
colors=( | |
['black']='\E[0;47m' | |
['red']='\E[0;31m' | |
['green']='\E[0;32m' | |
['yellow']='\E[0;33m' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function json_response($code = 200, $message = null) | |
{ | |
// clear the old headers | |
header_remove(); | |
// set the actual code | |
http_response_code($code); | |
// set the header to make sure cache is forced | |
header("Cache-Control: no-transform,public,max-age=300,s-maxage=900"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Método para gerar CNPJ válido, com máscara ou não | |
* @example cnpjRandom(0) | |
* para retornar CNPJ sem máscar | |
* @param int $mascara | |
* @return string | |
*/ | |
public static function cnpjRandom($mascara = "1") { | |
$n1 = rand(0, 9); | |
$n2 = rand(0, 9); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
//on pageload | |
session_start(); | |
$idletime=60;//after 60 seconds the user gets logged out | |
if (time()-$_SESSION['timestamp']>$idletime){ | |
session_destroy(); | |
session_unset(); | |
}else{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'========================================================================== | |
' JSON Encoder for VBScript | |
' Copyright (c) 2013 Atif Aziz. All rights reserved. | |
' | |
' Licensed under the Apache License, Version 2.0 (the "License"); | |
' you may not use this file except in compliance with the License. | |
' You may obtain a copy of the License at | |
' | |
' http://www.apache.org/licenses/LICENSE-2.0 | |
' |
This gist assumes:
- you have an online remote repository (github / bitbucket etc.)
- you have a local git repo
- and a cloud server (Rackspace cloud / Amazon EC2 etc)
- your (PHP) scripts are served from /var/www/html/
- your webpages are executed by Apache
- the Apache user is named
www-data
(may beapache
on other systems)
NewerOlder