Skip to content

Instantly share code, notes, and snippets.

View johndel's full-sized avatar
🖖

John Deliyiannis johndel

🖖
View GitHub Profile
@zhengjia
zhengjia / capybara cheat sheet
Created June 7, 2010 01:35
capybara cheat sheet
=Navigating=
visit('/projects')
visit(post_comments_path(post))
=Clicking links and buttons=
click_link('id-of-link')
click_link('Link Text')
click_button('Save')
click('Link Text') # Click either a link or a button
click('Button Value')
@Achillefs
Achillefs / transliterations.yml
Created April 18, 2011 12:52
Greek transliteration table for rails applications
el:
i18n:
transliterate:
rule:
α: a
ά: a
Α: a
Ά: a
β: v
Β: v
@cyx
cyx / gist:3690597
Created September 10, 2012 12:13 — forked from inkel/gist:3690584
Monit Redis
check process redis-server
with pidfile "/var/run/redis.pid"
start program = "/etc/init.d/redis-server start"
stop program = "/etc/init.d/redis-server stop"
if 2 restarts within 3 cycles then timeout
if totalmem > 100 Mb then alert
if children > 255 for 5 cycles then stop
if cpu usage > 95% for 3 cycles then restart
if failed host 127.0.0.1 port 6379 then restart
if 5 restarts within 5 cycles then timeout
@alexspeller
alexspeller / source_maps.rb
Created September 16, 2012 00:03
Coffeescript Source Maps in Rails
# config/initializers/source_maps.rb
if Rails.env.development?
require 'open3'
module CoffeeScript
class SourceMapError < StandardError; end;
class << self
def map_dir

Security is Hard

Massive Assignment

  • watch for ActiveRecord Relation, like has_many, has_many :through
  • watch for user_roles, `group_users
  • UPDATE action

Admin

@meesterdude
meesterdude / README.md
Last active March 23, 2017 17:42
emoji_spec is a microgem to put emoji in your rspec output.

Emoji Spec

results Tired of the same, dull rspec output? liven it up with some emoji!

Below are the sets presently available, and their corresponding id. if you don't set an ID, one will be randomly chosen every run. Emoji icons may not render in certain terminals.

(pass, fail, pending)

emoji

@skmp
skmp / Console based injection.js
Last active December 31, 2015 05:49
Summaries by using my fork of textteaser!
// Open the debug tools
// load the function using
// This requires the target site to have jquery loaded as $
$('<script src="https://rawgithub.com/skmp/textteaser/master/tease.js"></script>').appendTo('body');
//Use directly from console
//(replace with proper selectors for your page)
tease($('.title-selector').text(), $('.content-selector').text())
@emad-elsaid
emad-elsaid / worm.rb
Created March 19, 2014 12:15
Worm game in under 50 line of code in ruby
#!/usr/bin/env ruby
require 'gosu' # gem install gosu --no-document
include Gosu
$dimension, $splits = 200, 20
$size = $dimension.to_f / $splits.to_f
class Worm
attr_writer :dir
def initialize() reset end
@emad-elsaid
emad-elsaid / facebook-group-hall-of-fame.rb
Created March 20, 2014 12:11
Facebook group hall of fame script
#!/usr/bin/env ruby
require 'koala' # gem install koala --no-document
require 'psych'
# create a facebook app and get access token from here
# https://developers.facebook.com/tools/explorer
# select "user_groups" when authenticating
oauth_access_token = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'
group_name = 'Egyptian Geeks'
posts_limit = 100
graph = Koala::Facebook::API.new(oauth_access_token)
@Geokoumpa
Geokoumpa / gist:11365481
Created April 28, 2014 08:30
Ember-model findMany implementation
# this calls to a resource collection path adding an 'ids' param with comma separated ids, e.g. /posts?ids="1,2,3"
Ember.RESTAdapter.reopen findMany: (klass, records) ->
url = @buildURL(klass)
params = ids: records._ids.join(",")
@ajax(url, params).then (data) ->
collectionKey = Ember.get(klass, "collectionKey")
dataToLoad = (if collectionKey then Ember.get(data, collectionKey) else data)