Skip to content

Instantly share code, notes, and snippets.

# SUPER DARING APP TEMPLATE 1.0
# By Peter Cooper
# Link to local copy of edge rails
# inside('vendor') { run 'ln -s ~/dev/rails/rails rails' }
# Delete unnecessary files
# run "rm README"
# run "rm public/index.html"
# run "rm public/favicon.ico"
@jlsync
jlsync / file.js
Created May 14, 2010 11:57 — forked from quirkey/file.js
sammy.js get routes without changing the url / location hash
$.sammy(function() {
app.get('#/exams/new', function(context) {
// display the modal
window.setTimeout( function(){
context.app.location_proxy.unbind();
context.app.setLocation('#/');
context.app.last_location = '#/';
@jlsync
jlsync / beans
Created September 20, 2011 13:05 — forked from hookercookerman/beans
class of an instance attributes
class Animal
constructor: (@name) ->
move: (meters) ->
console.log @name + " moved #{meters}m."
class Snake extends Animal
@beans: ->
console.log("I eat beans")

Make it real

Ideas are cheap. Make a prototype, sketch a CLI session, draw a wireframe. Discussions around concrete examples, not handy-waving abstractions. Don't say you did something, provide a URL that proves it.

Ship it

Nothing is real until it's being used by a real user. This doesn't mean you make a prototype in the morning and blog about it in the evening. It means you find one person you believe your product will help and try to get them to use it.

Do it with style

require 'rspec/autorun'
def get_results(string, s_i, chars, c_i )
finds = []
while i = string.index(chars[c_i], s_i)
if chars[c_i + 1]
if more_finds = get_results(string, i + 1, chars , c_i + 1)
finds += more_finds.map{|a| a.unshift(i)}
else
return nil
@jlsync
jlsync / selenium-webdriver-cheatsheet.md
Created November 22, 2021 02:58 — forked from guorui9016/selenium-webdriver-cheatsheet.md
Ruby Selenium Webdriver CheatSheet

API workthough

  1. Open a browser

    # start an instance of firefox with selenium-webdriver
    driver = Selenium::WebDriver.for :firefox
    # :chrome -> chrome
    # :ie     -> iexplore
    
@jlsync
jlsync / trap_focus.js
Created November 26, 2022 08:46 — forked from myogeshchavan97/trap_focus.js
Code for trapping focus inside modal
// add all the elements inside modal which you want to make focusable
const focusableElements =
'button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])';
const modal = document.querySelector('#exampleModal'); // select the modal by it's id
const firstFocusableElement = modal.querySelectorAll(focusableElements)[0]; // get first element to be focused inside modal
const focusableContent = modal.querySelectorAll(focusableElements);
const lastFocusableElement = focusableContent[focusableContent.length - 1]; // get last element to be focused inside modal
@jlsync
jlsync / selenium-webdriver-cheatsheet.md
Created November 14, 2024 00:54 — forked from shoesCodeFor/selenium-webdriver-cheatsheet.md
Ruby Selenium Webdriver CheatSheet

API workthough

  1. Open a browser

    # start an instance of firefox with selenium-webdriver
    driver = Selenium::WebDriver.for :firefox
    # :chrome -> chrome
    # :ie     -> iexplore