Skip to content

Instantly share code, notes, and snippets.

View codespore's full-sized avatar
🔍
Looking for my next mission

Adrian Teh codespore

🔍
Looking for my next mission
View GitHub Profile
@rxaviers
rxaviers / gist:7360908
Last active June 7, 2024 15:06
Complete list of github markdown emoji markup

People

:bowtie: :bowtie: 😄 :smile: 😆 :laughing:
😊 :blush: 😃 :smiley: ☺️ :relaxed:
😏 :smirk: 😍 :heart_eyes: 😘 :kissing_heart:
😚 :kissing_closed_eyes: 😳 :flushed: 😌 :relieved:
😆 :satisfied: 😁 :grin: 😉 :wink:
😜 :stuck_out_tongue_winking_eye: 😝 :stuck_out_tongue_closed_eyes: 😀 :grinning:
😗 :kissing: 😙 :kissing_smiling_eyes: 😛 :stuck_out_tongue:
@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
@ThaiWood
ThaiWood / xkcd_passphrase.rb
Created May 28, 2013 02:33
A small Ruby script to generate passwords a la XKCD (http://xkcd.com/936/) using a wordlist seeded from a news article and words chosen using random atmospheric noise
#!/usr/bin/ruby
require 'net/http'
require 'nokogiri'
require 'rss'
require 'open-uri'
google_news_query = 'http://news.google.com/news/feeds?q=apologize&output=rss'
google_news_result_url = ''
wordlist = Array.new
@turadg
turadg / subdomains.rb
Last active January 21, 2024 19:45 — forked from rtekie/subdomains.rb
Drop-in utility to test your app subdomains with Capybara, Rspec, and a Javascript driver (Poltergeist, Webkit, or Selenium)
# Support for Rspec / Capybara subdomain integration testing
# Make sure this file is required by spec_helper.rb
# (e.g. save as spec/support/subdomains.rb)
def switch_to_subdomain(subdomain)
# lvh.me always resolves to 127.0.0.1
hostname = subdomain ? "#{subdomain}.lvh.me" : "lvh.me"
Capybara.app_host = "http://#{hostname}"
end
@font-face {
font-family: 'EntypoRegular';
src: url('font/entypo.eot');
src: url('font/entypo.eot?#iefix') format('embedded-opentype'),
url('font/entypo.woff') format('woff'),
url('font/entypo.ttf') format('truetype'),
url('font/entypo.svg#EntypoRegular') format('svg');
font-weight: normal;
font-style: normal;
}
@Mithrandir0x
Mithrandir0x / gist:3639232
Created September 5, 2012 16:15
Difference between Service, Factory and Provider in AngularJS
// Source: https://groups.google.com/forum/#!topic/angular/hVrkvaHGOfc
// jsFiddle: http://jsfiddle.net/pkozlowski_opensource/PxdSP/14/
// author: Pawel Kozlowski
var myApp = angular.module('myApp', []);
//service style, probably the simplest one
myApp.service('helloWorldFromService', function() {
this.sayHello = function() {
return "Hello, World!"
@codespore
codespore / Factory Girl Configs
Created July 31, 2012 18:27
Rails Application Development Cook Book
If repeating "FactoryGirl" is too verbose for you, you can mix the syntax methods in:
# rspec
RSpec.configure do |config|
config.include FactoryGirl::Syntax::Methods
end
# Test::Unit
class Test::Unit::TestCase
include FactoryGirl::Syntax::Methods
@blackxored
blackxored / client.coffee
Created July 2, 2012 04:44
Token authentication with Devise and Backbone
jQuery.ajaxSetup(
beforeSend: (xhr) ->
xhr.setRequestHeader('X-Auth-Token',
App.Session.getAuthenticationToken())
)
# ...
class App.Session
# ...
getAuthenticationToken: ->
@regedarek
regedarek / registrations_controller.rb
Created May 23, 2012 16:30 — forked from jwo/registrations_controller.rb
API JSON authentication with Devise
class Api::RegistrationsController < Api::BaseController
respond_to :json
def create
user = User.new(params[:user])
if user.save
render :json=> user.as_json(:auth_token=>user.authentication_token, :email=>user.email), :status=>201
return
else
@rtekie
rtekie / subdomains.rb
Created May 14, 2012 13:14
Support for Rspec / Capybara subdomain integration testing
# Support for Rspec / Capybara subdomain integration testing
# Make sure this file is required by spec_helper.rb
#
# Sample subdomain test:
# it "should test subdomain" do
# switch_to_subdomain("mysubdomain")
# visit root_path
# end
DEFAULT_HOST = "lvh.me"