Skip to content

Instantly share code, notes, and snippets.

bonyiii

Block or report user

Report or block bonyiii

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@mikkabouzu
mikkabouzu / facebook_graph_api.rb
Last active Jan 10, 2017
Facebook Graph API w/ Koala
View facebook_graph_api.rb
### app access token
graph = Koala::Facebook::OAuth.new APP_ID, APP_SECRET
graph.get_app_access_token # => APP_TOKEN
### create test users with permissions
test_users = Koala::Facebook::TestUsers.new app_id: APP_ID, secret: APP_SECRET
user = test_users.create true, 'email,user_birthday,user_posts', name: 'Bob'
# =>
# { "id" => USER_ID,
# "access_token" => USER_ACCESS_TOKEN,
View 0. Ruby Meta Programming - spells covered.md
  • Dynamic Dispatch
  • Dynamic Method
  • Ghost Methods
  • Dynamic Proxies
  • Blank Slate
  • Kernel Method
  • Flattening the Scope (aka Nested Lexical Scopes)
  • Context Probe
  • Class Eval (not really a 'spell' more just a demonstration of its usage)
  • Class Macros
@ekristen
ekristen / check_docker_container.sh
Last active Aug 1, 2019
Bash Script for Nagios to Check Status of Docker Container
View check_docker_container.sh
#!/bin/bash
# Author: Erik Kristensen
# Email: erik@erikkristensen.com
# License: MIT
# Nagios Usage: check_nrpe!check_docker_container!_container_id_
# Usage: ./check_docker_container.sh _container_id_
#
# Depending on your docker configuration, root might be required. If your nrpe user has rights
# to talk to the docker daemon, then root is not required. This is why root privileges are not
@lackac
lackac / 2_ways.md
Last active Aug 29, 2015
2 Ways to Decompose Fat ActiveRecord Models – budapest.rb 03/2014
View 2_ways.md
View gist:8712796
int dataPin = 2;
int clockPin = 3;
int csPin = 4;
byte chars[] = {
B00011000,
B00111100,
B01100110,
B11000011,
@wsargent
wsargent / docker_cheat.md
Last active Jun 20, 2019
Docker cheat sheet
View docker_cheat.md
@sheeley
sheeley / SessionsController.rb
Last active Dec 25, 2015
SAML Controller for Rails (used when POSTing data to IDP and decrypting on return)
View SessionsController.rb
class SessionsController < ApplicationController
skip_before_filter :verify_authenticity_token, only: :saml
def new
request = Onelogin::Saml::Authrequest.new
settings = saml_settings
request_doc = request.create_authentication_xml_doc(settings)
request_str = request_doc.to_s #.force_encoding("UTF-8")
logger.debug request_str
@framallo
framallo / makefile
Last active Mar 23, 2016
This is a makefile to deploy a rails application using puma, runit and apache
View makefile
# This is the deployment recipe
# You require to install runit on the server.
# First you need to declare on which port the application will run
#
# echo 3000 > port
#
# Then you can setup a new runit service with
#
# make setup_service
#
@toolmantim
toolmantim / Makefile
Last active Jun 8, 2018
An example of using Make instead of Grunt for fast, simple and maintainable front-end asset compilation.
View Makefile
# A simple Makefile alternative to using Grunt for your static asset compilation
#
## Usage
#
# $ npm install
#
# And then you can run various commands:
#
# $ make # compile files that need compiling
# $ make clean all # remove target files and recompile from scratch
@mudge
mudge / unicorn.conf.rb
Last active Feb 9, 2017
Unicorn configuration for Rails 3.2 application to log to a different file per worker (to stop logs interleaving with one another).
View unicorn.conf.rb
after_fork do |server, worker|
# Override the default logger to use a separate log for each Unicorn worker.
# https://github.com/rails/rails/blob/3-2-stable/railties/lib/rails/application/bootstrap.rb#L23-L49
Rails.logger = ActiveRecord::Base.logger = ActionController::Base.logger = begin
path = Rails.configuration.paths["log"].first
f = File.open(path.sub(".log", "-#{worker.nr}.log"), "a")
f.binmode
f.sync = true
logger = ActiveSupport::TaggedLogging.new(ActiveSupport::BufferedLogger.new(f))
You can’t perform that action at this time.