Skip to content

Instantly share code, notes, and snippets.

@tamboer
tamboer / git_init_create.txt
Last active December 21, 2015 19:09
git init create
Git global setup:
git config --global user.name "user"
git config --global user.email "[email protected]"
Create Repository
mkdir new_repo
cd new_repo
git init
@tamboer
tamboer / time_to_decimal.php
Created August 26, 2013 13:34
time to decimal function
protected function _timeToDecimal($time){
list($hours,$minutes) = array_pad(explode(':',$time, 2), 2, null);
if(is_null($minutes)) $minutes = '00';
if(strstr($hours, '-')){
$negative=true;
$hours = 0 - $hours;
}else{
$negative= false;
@tamboer
tamboer / git_file_permissions.txt
Created August 22, 2013 11:16
git file permissions
... git didn’t like that some of the permissions had changed on the files within my repos.
So, after reading the manual for a while, I discovered I could issue the following:
git config core.filemode false
According to the git manual:
@tamboer
tamboer / scp.txt
Last active March 27, 2026 05:36
scp secure copy examples from http://www.hypexr.org/linux_scp_help.php
Example syntax for Secure Copy (scp)
What is Secure Copy?
scp allows files to be copied to, from, or between different hosts. It uses ssh for data transfer and provides the same authentication and same level of security as ssh.
Examples
--------
Copy the file "foobar.txt" from a remote host to the local host
//use EXAMPLE
$response = SendPostData($_POST, 'http://www.myserver2location.com/receive-data.php');
/**
* SendPostData()
*
* @param mixed $_p
* @param mixed $remote_url
@tamboer
tamboer / type_hinting.php
Created July 19, 2013 12:01
php type hinting
<?php
// An example class
class MyClass
{
/**
* A test function
*
* First parameter must be an object of type OtherClass
@tamboer
tamboer / render-html-select.php
Created July 17, 2013 08:26
render html selectors
<?php
/**
* html selectors
*
* set of html selectors on dashboard and ...
*
* TODO OPTIONS
* 1. pass one big array and loop to create selectors
* 2. add specific functionality
@tamboer
tamboer / git-stuff.txt
Created July 12, 2013 12:46
git random stuff
change from https to ssh
example: git remote set-url origin [email protected]:user/gitname.git
@tamboer
tamboer / htaccess-apache.txt
Last active December 19, 2015 09:28
apache .htaccess .htpasswd
#.htaccess
AuthName "Restricted Area"
AuthType Basic
AuthUserFile /var/www/path to /public_html/.htpasswd
AuthGroupFile /dev/null
require valid-user
#.htpasswd
@tamboer
tamboer / Logger.php
Last active December 19, 2015 09:28
PHP Class to create logfile logging actions with messages
/*
* NOTES:
*
* TODO: Consider some static methods or running the logger as a plugin
*
*
*/
class Logger {