Skip to content

Instantly share code, notes, and snippets.

View leompeters's full-sized avatar
😎
...

Leo M. Peters leompeters

😎
...
View GitHub Profile
@sabind
sabind / README.md
Last active May 5, 2016 18:45
Adding 'grunt test' to SailsJS 0.10.x using grunt and mocha

This is an addition to a full guide on SailsJS + Mocha, but updated for SailsJS 0.10.x

The guide does not belong to me, only this change to support SailsJS 0.10.x using code originally found in the guide written by it's author.

@nicholasjhenry
nicholasjhenry / rdoc-example.rb
Last active January 19, 2017 05:50
RDoc Example
# * Style guide based on Rails documention
module Namespace #:nodoc: don't document this
# Generic Namespace exception class
class NamespaceError < StandardError
end
# Raised when...
class SpecificError < NamespaceError
end
@n8agrin
n8agrin / net_http_digest_auth.rb
Created March 3, 2009 00:29
HTTP Digest Auth for Ruby's net/http
# Support for http digest auth
# Discovered here: http://johan.bingodisk.com/public/code/net_digest_auth.rb
require 'digest/md5'
require 'net/http'
module Net
module HTTPHeader
@@nonce_count = -1
CNONCE = Digest::MD5.new("%x" % (Time.now.to_i + rand(65535))).hexdigest
@javascript
Scenario: confiming when saving inactive
Given I expect to click "OK" on a confirmation box saying "Are you sure?"
When I press "Save"
Then the confirmation box should have been displayed
And I should see "TV" in the "Campaign Keywords" section
Scenario: alert when form is not valid
Given I expect to click on an alert box saying "Please complete all fields in this form"
When I press "Save"
@bhelx
bhelx / test.php
Last active September 16, 2017 12:29
TLS Low Level Testing. You should expect to see it print TLS version 1.2.
<?php
// This example is for testing php with libcurl
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://www.howsmyssl.com/a/check");
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, TRUE);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
@marionebl
marionebl / express.js
Last active July 2, 2018 19:16
Sails: Disable x-powered-by header
/**
* Configure advanced options for the Express server inside of Sails.
*
* For more information on configuration, check out:
* http://sailsjs.org/#documentation
*/
module.exports.express = {
middleware: {
poweredBy: false
},
@leompeters
leompeters / abstract_interface.rb
Last active December 13, 2018 18:55
Building Interfaces and Abstract Classes in Ruby.
# Object Interface in Ruby.
# Suggestion of implementation for object-oriented interfaces.
#
# ===== Example
#
# bike = AcmeBicycle.new
# bike.change_gear(1)
# # => AbstractInterface::InterfaceNotImplementedError: AcmeBicycle needs to implement 'change_gear' for interface Bicycle!
#
# See:: http://www.metabates.com/2011/02/07/building-interfaces-and-abstract-classes-in-ruby
@leompeters
leompeters / belanton_atom_settings
Last active December 17, 2018 16:41
Atom editor settings for Belanton Team.
Atom editor settings for Belanton Team.
You can use these settings on your Atom editor [http://atom.io] copy. Here are
defaults Atom config files (config.cson, init.coffee, keymap.cson, snippets.cson and
styles.less) and Project Manager package list [http://atom.io/packages/project-manager].
@leompeters
leompeters / .belanton_rubymine_livetemplates
Last active March 7, 2019 20:18
RubyMine Live Templates for commented items at Belanton Team.
You can use these settings on your RubyMine [http://rubymine.org]. Here are some RubyMine Live Templates.
@gonzalolarralde
gonzalolarralde / tvos_prohibited.md
Last active December 24, 2019 16:19
Classes and Methods prohibited to tvOS
$ grep -lR "__TVOS_PROHIBITED" . | while read L; do echo "## $L"; echo "\`\`\`obj-c"; grep "__TVOS_PROHIBITED" "$L"; echo "\`\`\`"; echo; done

./AVFoundation.framework/AVAudioSession.h

AVAudioSessionPortOverrideSpeaker __TVOS_PROHIBITED = 'spkr'

AVAudioSessionCategoryOptionAllowBluetooth	__TVOS_PROHIBITED		= 0x4,
AVAudioSessionCategoryOptionDefaultToSpeaker __TVOS_PROHIBITED		= 0x8,