Skip to content

Instantly share code, notes, and snippets.

View zeroeth's full-sized avatar
🤖
🐱 🤖 🐱 🤖

[0] zeroeth

🤖
🐱 🤖 🐱 🤖
View GitHub Profile
@zeroeth
zeroeth / ajax.js
Created January 18, 2014 04:26
rails ajax
$("button").click(function() {
$.ajax({
type: "POST",
url: "/products",
data: { product: { name: "Filip", description: "whatever" } },
success: function (data) {
alert(data.id);
return false;
},
error: function(data) {
@zeroeth
zeroeth / filters.php
Created January 15, 2014 23:01
Laravel request debugging.
<?php
use Illuminate\Support\Facades\Log;
/**
* Debug request information.
*/
Route::filter('debug_info', function( $route, $request ) {
Log::debug("REQUEST", array(
@zeroeth
zeroeth / git-branch-status.sh
Last active December 31, 2015 16:19
git branch distance status
#!/bin/bash
# modified by http://github.com/zeroeth for color/alignment
# modified by http://github.com/kortina
# original from http://github.com/jehiah
# this prints out branch ahead/behind status vs origin/master for all branches
# example:
# $ git-branch-status
# dns_check (ahead 1) | (behind 112) origin/master
# master (ahead 2) | (behind 0) origin/master
@zeroeth
zeroeth / existing_remote_branches.sh
Last active December 31, 2015 13:29
git client svn workflows
# Only needed once, rather slow. checkout the project url without /trunk on the end.
# -b needs test/branches because a non-standard layout in the repo I'm working with.
#
git svn clone https://<repo url> -T trunk -b test/branches -t tags <local folder name>
# Mirror the svn ignore into your local git (Does not require checking in any git related files)
# can take a few minutes, make sure you are in the project folder first.
#
git svn show-ignore >> .git/info/exclude
# LOCAL GIT REPO COMMANDS
#
# in project folder
git init .
# (rinse repeat this pattern)
# CODECODECODE
@zeroeth
zeroeth / gitsvn.sh
Last active December 31, 2015 07:09
git svn happy times
# create remote branch
git svn branch new_feature
# check out new local branch
git checkout -b new_feature
# the magic command to setup the svn remote properly
git rebase remotes/new_feature
# (your git commits here)
@zeroeth
zeroeth / router.js
Last active December 31, 2015 01:29
Backbone.js missing route catch all
Backbone.Router.extend({
routes: {
"": "showWelcome",
"other": "showOther",
"*nomatch": "notFound",
},
notFound: function() {
console.info("Route not found:", arguments);
},
@zeroeth
zeroeth / .vimrc
Last active December 30, 2015 22:49
SlimVim
" Indentation Settings
"
" Soft 2 space
" set tabstop=2
" set shiftwidth=2
" set expandtab
" Hard tab
set noexpandtab
set tabstop=4
set shiftwidth=4
@zeroeth
zeroeth / attr.rb
Last active December 30, 2015 08:09
ruby magic
class Awesome
attr_accessor :first_var
def second_var= value
@second_var = value;
end
def second_var
@second_var
end
@zeroeth
zeroeth / mintbook.sh
Last active December 29, 2015 16:08
dotfile prompts from my various machine evolutions
# from bendyworks
function parse_git_branch {
\git rev-parse --git-dir &> /dev/null
git_status="$(git status 2> /dev/null)"
branch_pattern="^# On branch ([^${IFS}]*)"
remote_pattern="# Your branch is (.*) of"
diverge_pattern="# Your branch and (.*) have diverged"
if [[ ! ${git_status}} =~ "working directory clean" ]]; then
state="${RED}⚡"
fi