Skip to content

Instantly share code, notes, and snippets.

View danpecher's full-sized avatar

Daniel Pecher danpecher

View GitHub Profile
@danpecher
danpecher / navigation_helper.rb
Created May 13, 2016 14:14 — forked from skojin/navigation_helper.rb
Rails Helper to build 'active' links
module NavigationHelper
# get navigation 'active' css class if rule match
def nav_class(match_rules)
navigation_url_active?(nil, match_rules) ? 'active' : nil
end
# @param match_rules if :resource symbol, then match to url that starts withs specified url
# @param match_rules if :same symbol, then match exactly to url
# @param match_rules if hash {:controller, :action, :path, :method} and same yes with _not suffix (like :controller_not)
@danpecher
danpecher / rubymine-debugging.md
Last active August 19, 2019 13:02
How to enable RubyMine debugging when using pow and rails

First create a .powenv file and add:

export RUBY_DEBUG_PORT=1234
export POW_WORKERS=1

Add the following gems to your Gemfile:

gem 'ruby-debug-ide'
@danpecher
danpecher / webpack.config.js
Created February 10, 2016 19:55
Basic webpack config with react hot reloading
var path = require('path');
var webpack = require('webpack');
module.exports = {
entry: {
app: ['webpack-dev-server/client?http://localhost:5000',
'webpack/hot/only-dev-server',
'./index']
},
output: {
git config --global alias.lg "log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit"
var app = angular.module('test', []);
app.controller('MainController', function($scope, $http){
$scope.formData = {
'first_name': '',
'last_name': ''
};
$scope.submitHandler = function() {
$http({
@danpecher
danpecher / gist:161b9408d14f3fefccdd
Created December 10, 2014 22:48
Linux Objective-C Makefile
all:
gcc main.m -o app `gnustep-config --objc-flags` -lobjc -lgnustep-base
@danpecher
danpecher / gulpfile.js
Created December 10, 2014 07:48
Gulpfile.js stub
var gulp = require('gulp');
var stylus = require('gulp-stylus');
var concat = require('gulp-concat');
var uglify = require('gulp-uglify');
var rename = require('gulp-rename');
var streamqueue = require('streamqueue');
var STYLES = 'app/assets/style/**/*.styl';
var JAVASCRIPTS = 'app/assets/js/**/*.js';
<?php
/*
* In template
*/
get_query_var($var);
/*
* functions.php
*/
add_filter('rewrite_rules_array','wp_insertMyRewriteRules');
.c:after{
clear: both;
content: "";
display: block;
}
@danpecher
danpecher / script.sh
Created August 15, 2013 10:33
Sublime Text 2 - hide gtk menubar
#!/bin/bash
sudo apt-get install git-core valac-0.14 libvala-0.14-dev libgtk-3-dev gobject-introspection libgirepository1.0-dev libgtk2.0-dev autotools-dev automake autoconf intltool libtool
git clone git://github.com/gnome-globalmenu/gnome-globalmenu.git
cd gnome-globalmenu
git checkout gnome-3
autoreconf --force --install --verbose
./autogen.sh --prefix=/usr
make
sudo make GTK2_MODULES_DIR=/usr/lib/gtk-2.0/modules GTK3_MODULES_DIR=/usr/lib/gtk-3.0/modules GLIB_COMPILE_SCHEMAS=/bin/true install
sudo glib-compile-schemas /usr/share/glib-2.0/schemas