Skip to content

Instantly share code, notes, and snippets.

:octocat:
Working on personal projects

Joseph Rex josephrexme

:octocat:
Working on personal projects
View GitHub Profile
View face.py
#!/usr/bin/python
import re
from sys import argv
import socket
import mechanize
import scapy
script, arg1, arg2 = argv
# Taken 2 arguments for the network packet sniffer
View gist:11017642
<?php
/**
* Get human readable time difference between 2 dates
*
* Return difference between 2 dates in year, month, hour, minute or second
* The $precision caps the number of time units used: for instance if
* $time1 - $time2 = 3 days, 4 hours, 12 minutes, 5 seconds
* - with precision = 1 : 3 days
* - with precision = 2 : 3 days, 4 hours
@josephrexme
josephrexme / SassMeister-input.sass
Created Jun 9, 2014
Generated by SassMeister.com.
View SassMeister-input.sass
// ----
// Sass (v3.3.8)
// Compass (v1.0.0.alpha.19)
// ----
=box-sizing($value)
-webkit-box-sizing: $value
-moz-box-sizing: $value
box-sizing: $value
@josephrexme
josephrexme / SassMeister-input.sass
Created Jun 13, 2014
Generated by SassMeister.com.
View SassMeister-input.sass
// ----
// Sass (v3.3.8)
// Compass (v1.0.0.alpha.19)
// ----
.grid-inner address
@extend #tiles li .overview p
.grid-inner address:before
content: "~ "
View tmux.md

tmux cheat sheet

(C-x means ctrl+x, M-x means alt+x)

Prefix key

The default prefix is C-b. If you (or your muscle memory) prefer C-a, you need to add this to ~/.tmux.conf:

# remap prefix to Control + a
View keybase.md

Keybase proof

I hereby claim:

  • I am josephrexme on github.
  • I am josephrexme (https://keybase.io/josephrexme) on keybase.
  • I have a public key ASBa0d3rxEv4t-TsMIGRPL5ZZGKgpq0G0Q2c2PkSrZe1Ego

To claim this, I am signing this object:

@josephrexme
josephrexme / _helpers.scss
Last active Aug 29, 2015
rake assets precompile failure
View _helpers.scss
/* ==========================================================================
* Helper classes
* ========================================================================== */
//@import "variables";
/* Image replacement */
.ir {
background-color: transparent;
border: 0;
overflow: hidden;
/* IE 6/7 fallback */
@josephrexme
josephrexme / .htaccess
Created Dec 22, 2014
htaccess for apache web servers using PHP frameworks like Laravel
View .htaccess
<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
Options -MultiViews
</IfModule>
RewriteEngine On
# Redirect Trailing Slashes...
RewriteRule ^(.*)/$ /$1 [L,R=301]
@josephrexme
josephrexme / company.html.erb
Last active Aug 29, 2015
First argument in form cannot be nil error
View company.html.erb
<div class="content pad10">
<%= form_for @department do |f| %>
<p>
<%= f.label :department, 'Department Name' %>
<%= f.text_field 'department' %>
</p>
<p>
<%= f.label :parent %>
<% department_array = @departments.all.map { |department| [department.name, department.id + 1] } %>
<%= f.select :parent, options_for_select(department_array) %>
@josephrexme
josephrexme / dashboard_controller.rb
Created Dec 23, 2014
How I display a list of child departments on my dashboard index
View dashboard_controller.rb
class DashboardController < ApplicationController
before_action :require_login
before_filter :init
def index
@departments.each do |department|
childfetch = Department.where(parent: "#{department.name}").select('name')
instance_variable_set("@#{department.name}Children".gsub(' ','_'), childfetch.map { |child| "#{child.name}" }.join(',') )
end
end
You can’t perform that action at this time.