Skip to content

Instantly share code, notes, and snippets.

View myabc's full-sized avatar

Alexander Brandon Coles myabc

  • London, England
  • 23:08 (UTC +01:00)
View GitHub Profile
@henrypoydar
henrypoydar / config.yml
Created November 20, 2017 00:19
Rails 5.1 CircleCI 2.0 Configuration
version: 2
jobs:
build:
environment:
working_directory: ~/circleci-myapp
docker:
- image: circleci/ruby:2.4.2-node-browsers
environment:
CC_TEST_REPORTER_ID: XXXYYY
RAILS_ENV: test
@codeluggage
codeluggage / es6ToNightwatch.js
Last active October 22, 2021 04:47
Convert ES6 classes to basic Javascript objects to export for Nightwatch
'use strict';
/*
* The purpose of this function is to convert an ES6 class to either:
* 1) A test suite if it has "tests" as a property
* 2) A page object with optional "elements", "commands" and "url"
* @param es6Class The actual class object (not instance of the class) to convert
*/
module.exports = function(es6Class) {
let properties = Object.getOwnPropertyNames(es6Class.prototype);
@fran-worley
fran-worley / _form.html.erb
Last active October 23, 2017 23:42
A working example of nested forms just using Reform.
#views/users/_form.html.erb
<%= simple_form_for @form do |f| %>
<%= f.error_notification %>
<%= f.input :name %>
<%= f.input :email %>
<h4>
<%= link_to_add_fields icon(:plus),
@smileart
smileart / euruko2015.md
Last active October 20, 2023 07:20
Euruko 2015
@scy
scy / README.md
Last active July 7, 2023 09:27
My OSX PF config for #30C3.

My OS X “VPN only” Setup For #30C3

You should never let passwords or private data be transmitted over an untrusted network (your neighbor’s, the one at Starbucks or the company) anyway, but on a hacker congress like the #30C3, this rule is almost vital.

Hackers get bored easily, and when they’re bored, they’re starting to look for things to play with. And a network with several thousand connected users is certainly an interesting thing to play with. Some of them might start intercepting the data on the network or do other nasty things with the packets that they can get.

If these packets are encrypted, messing with them is much harder (but not impossible! – see the end of this article). So you want your packets to be always encrypted. And the best way to do that is by using a VPN.

Target audience

@sj26
sj26 / assets.rake
Last active May 13, 2023 04:42
Don't discard cache during asset precompile. Full explanation and caveats: http://sj26.com/2013/02/09/the-asset-pipeline-isnt-actually-slow
# Stick this in lib/tasks/assets.rake or similar
#
# A bug was introduced in rails in 7f1a666d causing the whole application cache
# to be cleared everytime a precompile is run, but it is not neccesary and just
# slows down precompiling.
#
# Secondary consequences are the clearing of the whole cache, which if using
# the default file cache could cause an application level performance hit.
#
# This is already fixed in sprockets-rails for rails 4, but we patch here for
@kazpsp
kazpsp / passwords_controller.rb
Created August 14, 2012 16:40 — forked from guilleiguaran/passwords_controller.rb
StrongParameters with Devise
# app/controllers/users/password_controller.rb
class Users::PasswordsController < Devise::PasswordsController
def resource_params
params.require(:user).permit(:email, :password, :password_confirmation)
end
private :resource_params
end
@seanlilmateus
seanlilmateus / gist:3187192
Last active March 5, 2021 07:17
How to use Obj-C with MacRuby/Rubymotion

Using Obj-C with MacRuby/Rubymotion

This little post aims to help you to translate Objective-C Blocks into Ruby blocks. Let's start by taking a look at few examples of iOS API call where blocks are used for animations and enumeration

Ruby Lambda Syntaxes:

Im Rubymotion and MacRuby you can use all the Ruby Lambda syntaxes that are:

block = lambda { |param|  ... }
@kilaulena
kilaulena / gist:2561283
Created April 30, 2012 18:56
Drilling in your wall and not in cables
TIL when you drill in your wall (eg to hang up a shelf), these are ways to avoid drilling into a power
supply:
- I always thought this rule of thumb would suffice: do not drill within a straight vertical or
horizontal line from power sockets. TIL in Germany to be on the safe side, you need to add a 20cm safety
distance to each side of these lines. Within this distance can be supply lines too!
- Power supply line detectors are worthless when they are cheap, the pricier ones can help you a bit, but
they still are no guarantee: when the lines are deeper within the wall, they can not be detected exactly
at all.
@bumi
bumi / psych_yml_tester.rb
Created June 7, 2011 09:53 — forked from jhilden/yamltester.rb
YAML tester
# USAGE:
# ruby -e "$(curl -fsSL https://raw.github.com/gist/1011972/2e6ac978bc06905f60e380b5fe5abbf898b3af0a)" <directory>
# for example:
# ruby -e "$(curl -fsSL https://raw.github.com/gist/1011972/2e6ac978bc06905f60e380b5fe5abbf898b3af0a)" .
require 'rubygems'
require 'yaml'
YAML::ENGINE.yamler = 'psych'
directory = ARGV[0]