Skip to content

Instantly share code, notes, and snippets.

View powellmichael's full-sized avatar

Michael Powell powellmichael

View GitHub Profile
@kmaida
kmaida / _mq.scss
Created April 3, 2015 16:28
Sass media query mixin that accepts media query string as argument
/*-- Media query variables --*/
$mq-small: 'media and (max-width: 767px)';
$mq-large: 'media and (min-width: 768px)';
/*-- Media query mixin --*/
@mixin mq($mqString) {
@media #{$mqString} {
@content;
@jennybc
jennybc / digest_header_links.R
Created February 7, 2015 19:50
Digest link header in paginated GitHub API request
@vijedi
vijedi / base_controller.rb
Created November 8, 2014 15:14
Pagination with angular-paginate-anything and kaminari
class Api::BaseController < ApplicationController
include Rivalry::OrganizationScope
respond_to :json
private
def self.paginated_action(options = {})
before_filter(options) do |controller|
if request.headers['Range-Unit'] == 'items' &&
request.headers['Range'].present?
@kmaida
kmaida / dynamicPagRepeatAngular.html
Last active December 13, 2023 14:37
AngularJS - Dynamic pagination on ng-repeat with search/filtering. Use with ui.bootstrap
<!DOCTYPE HTML>
<html lang="en" ng-app="myApp">
<head>
<meta charset="utf-8">
<title>Dynamic Pagination w/ Filtering</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="">
<meta name="author" content="Kim Maida">
<!-- JS Libraries -->
@benlesh
benlesh / app.js
Last active January 14, 2022 23:52
Angular - Basics of Unit Testing a Controller
var app = angular.module('myApp', []);
/* Set up a simple controller with a few
* examples of common actions a controller function
* might set up on a $scope. */
app.controller('MainCtrl', function($scope, someService) {
//set some properties
$scope.foo = 'foo';
$scope.bar = 'bar';
@drush
drush / heroku-dynos.rb
Last active September 11, 2017 17:05
Show a report of the current number of web and worker dynos and the stack used across all your Heroku apps.
apps = `heroku apps`.split("\n\n")[0].lines[1..-1].collect{|l| l.strip }
printf("%-20s %4s %4s\n", 'APP', 'WEB', 'BG')
apps.each{|a|
astats = `heroku ps -a #{a}`
info = `heroku apps:info -a #{a}`
access = `heroku access -a #{a}`
stack = info.scan(/Stack:\s+(.*)/).first.last rescue 'NA'
web, workers = (astats.match(/web\.\d/).size rescue 0), (astats.match(/worker\.\d/).size rescue 0)
printf("%-20s %4s %4s %20s\t#{access}\n", a, web, workers, stack)
}
set -g prefix C-a # Make C-a the prefix instead of default
bind C-a send-prefix # Send to application
unbind C-b # Unbind C-b
set -sg escape-time 1 # Remove delay for keystrokes
setw -g mode-keys vi # Use vi mode
### Mouse mode ###
setw -g mode-mouse on # Toggle mouse mode globally
set -g mouse-select-pane on # Select pane using mouse
@alex-zige
alex-zige / gist:5795358
Last active June 8, 2023 07:49
Rails Rspec API Testing Notes

Rails Rspec APIs Testing Notes

Folders Structure

  spec
  |--- apis #do not put into controllers folder. 
        |--- your_api_test_spec.rb  
  |--- controllers
  |--- models
  |--- factories
 |--- views
@h3h
h3h / 0-resume-template.md
Last active July 28, 2016 13:07
Ideal Resume Format for a Software Engineer

https://github.com/[yourname]

Ambition

[Describe ambitions: type of work, attributes of team, what you want to learn & teach]

Experience

[in reverse chronological order, list at most 5 positions or 10 years back, whichever is fewer]

@ryansobol
ryansobol / gist:5252653
Last active November 22, 2023 11:53
15 Questions to Ask During a Ruby Interview

Originally published in June 2008

When hiring Ruby on Rails programmers, knowing the right questions to ask during an interview was a real challenge for me at first. In 30 minutes or less, it's difficult to get a solid read on a candidate's skill set without looking at code they've previously written. And in the corporate/enterprise world, I often don't have access to their previous work.

To ensure we hired competent ruby developers at my last job, I created a list of 15 ruby questions -- a ruby measuring stick if you will -- to select the cream of the crop that walked through our doors.

What to expect

Candidates will typically give you a range of responses based on their experience and personality. So it's up to you to decide the correctness of their answer.