Instantly share code, notes, and snippets.

  • Allow a content block to be set for head content:
    • On views/layout/base/html.haml:
      • Replace all the content from inside the head tag with render_content_block(@cms_page.head_content_block_with_default.try(:slug)) (where @cms_page is an instance of Cms::PageConfiguration::PageWrapper)
    • Add head_content_block_with_default method to Cms::PageConfiguration::PageWrapper defined as:
    def head_content_block_with_default
    • Add a migration that adds a head_content_block_id to cms_full_pages and cms_rails_pages
View guessnumber.hs
import System.Random
turn :: Int -> Int -> IO ()
turn target n =
do if n == target
then putStrLn "You win!!!"
else do
if n < target
then putStrLn "Too small"
else putStrLn "Too big"
View haskell.hs
check :: String -> String -> Char -> (Bool, String)
check word display c
= ( c `elem` word, [if x == c
then c
else y | (x,y) <- zip word display])
turn :: String -> String -> Int -> IO ()
turn word display n =
do if n == 0
then putStrLn "You lose"
View haskell_exercise.hs
import System.Random
starman :: Int -> IO ()
starman n = do
g <- newStdGen
words = ["hello", "world", "haskell"]
word = words!!(fst (randomR (0,(length words) - 1) g))
turn word ['-' | x <- word] n
View rspec output
Pending: (Failures listed here are expected and do not affect your suite's status)
1) Store Locator Mobile initial page load
# pending finding a fix for poltergeist not loading google maps API
# ./spec/features/retailers/store_locator_mobile_spec.rb:35
2) Store Locator Mobile searching using the current location with no surrounding stores
# pending finding a fix for poltergeist not loading google maps API
# ./spec/features/retailers/store_locator_mobile_spec.rb:39
View 0_reuse_code.js
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
View ajax.js
var root = '';
var options;
url: root + '/users',
method: 'GET',
}).then(function(data) { u => u.username );
View device_customers_report
"$group" => {
_id: "$device_id",
View .bashrc
# colors!
# '\u' adds the name of the current user to the prompt
# '\$(__git_ps1)' adds git-related stuff
# '\W' adds the name of the current directory