Skip to content

Instantly share code, notes, and snippets.

View m3nt0r's full-sized avatar

Kjell Bublitz m3nt0r

  • mediacode GmbH
  • Germany
View GitHub Profile
@m3nt0r
m3nt0r / backbone.snapnroll.js
Last active December 23, 2015 15:19
A simple snapshot extension for Backbone models written mainly to introduce a rollback() feature
_.extend(Backbone.Model.prototype, {
/**
* Copy current attributes and store it in a private property
*
* @returns Model Instance
* @type Object
*/
createSnapshot: function () {
this._snapshot = _.clone(this.attributes);
return this;
@m3nt0r
m3nt0r / proxy-toggle.sh
Last active April 13, 2016 23:39 — forked from mnewt/proxy-toggle.sh
Added "start" command which creates a local SSH tunnel to a pre-configured server. The connection may then be used as SOCKS proxy within the Mac OSX network settings (and this toggle script)
#!/bin/sh
SSH_HOST=you@some.server.tld
SSH_PORT=22
PROXY_INTERFACE="Wi-Fi"
PROXY_HOST=localhost
PROXY_PORT=8080
if [[ $1 == "start" ]]; then
@m3nt0r
m3nt0r / exampleA.php
Last active December 16, 2015 18:09
ImageHelper url example
<?php
echo $html->link(
$html->image('cake.power.gif', array(
'alt'=> __("CakePHP...", true),
'border'=>"0"
)),
'http://www.cakephp.org/',
array('target' => '_blank'), null, false
);
@m3nt0r
m3nt0r / bootstrap.php
Created April 27, 2013 22:29
Use Environment class with CakePHP database.php
config('environments');
@m3nt0r
m3nt0r / gist:5474976
Created April 27, 2013 22:19
jekyll clone post-receive build (working)
GIT_REPO=$HOME/myrepo.git
TMP_GIT_CLONE=$HOME/tmp/myrepo
PUBLIC_WWW=/var/www/myrepo
git clone $GIT_REPO $TMP_GIT_CLONE
cd $TMP_GIT_CLONE
jekyll --no-auto $TMP_GIT_CLONE $PUBLIC_WWW
rm -Rf $TMP_GIT_CLONE
exit
@m3nt0r
m3nt0r / post-receive-jekyll.sh
Created April 27, 2013 22:18
jekyll clone post-receive build
GIT_REPO=$HOME/myrepo.git
TMP_GIT_CLONE=$HOME/tmp/myrepo
PUBLIC_WWW=/var/www/myrepo
git clone $GIT_REPO $TMP_GIT_CLONE
jekyll --no-auto $TMP_GIT_CLONE $PUBLIC_WWW
rm -Rf $TMP_GIT_CLONE
exit
@m3nt0r
m3nt0r / gist:5470731
Created April 26, 2013 21:55
My bash git-aliases
alias commit='git commit -am'
alias status='git status'
alias checkout='git checkout'
alias merge='git merge --squash'
alias undomerge='git reset --merge'
alias lastlog='git log -1'
alias log='git log --pretty=oneline'
alias pushsvn='git svn dcommit'
alias our='git checkout --ours'
alias their='git checkout --theirs'
@m3nt0r
m3nt0r / default.tpl
Created September 21, 2010 05:58
TwigView for CakePHP
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN">
<html>
<head>
{{ html.charset() }}
<title>{{ 'CakePHP: the rapid development php framework'|trans }}: {{ title_for_layout }}</title>
{{ html.meta('icon') }}
{{ html.css('cake.generic') }}
{{ scripts_for_layout }}
</head>
<body>
<?php
/**
* SchemateBehavior - Somewhat ActivRecord'ish for CakePHP..
*
* @author Kjell Bublitz
* @link http://cakealot.com
* @license MIT
*/
class SchemataBehavior extends ModelBehavior {