Skip to content

Instantly share code, notes, and snippets.

View mheesters's full-sized avatar

Martijn Heesters mheesters

View GitHub Profile
@Takazudo
Takazudo / dateconvert.js
Created March 9, 2012 16:03
Backbone.js date convert
var MyModel = Backbone.Model.extend({
initialize: (attrs){
var self = this;
self.updateDate();
self.bind('change:date', function(){
self.updateDate();
});
},
updateDate: function(){
var date = this.get('date');
@lemiorhan
lemiorhan / post-receive
Last active February 8, 2023 10:06
Post-receive hook to deploy the code being pushed to production branch to a specific folder
#!/bin/bash
target_branch="production"
working_tree="PATH_TO_DEPLOY"
while read oldrev newrev refname
do
branch=$(git rev-parse --symbolic --abbrev-ref $refname)
if [ -n "$branch" ] && [ "$target_branch" == "$branch" ]; then
@magnetikonline
magnetikonline / dumprequest.php
Last active July 18, 2024 19:50
PHP script to dump full HTTP request to file (method, HTTP headers and body).
<?php
// https://gist.github.com/magnetikonline/650e30e485c0f91f2f40
class DumpHTTPRequestToFile {
public function execute($targetFile) {
$data = sprintf(
"%s %s %s\n\nHTTP headers:\n",
$_SERVER['REQUEST_METHOD'],
$_SERVER['REQUEST_URI'],
$_SERVER['SERVER_PROTOCOL']