Skip to content

Instantly share code, notes, and snippets.

View ziyan-junaideen's full-sized avatar
👋
How you doing?

Ziyan Junaideen ziyan-junaideen

👋
How you doing?
View GitHub Profile
@ziyan-junaideen
ziyan-junaideen / safe_callback.coffee
Created January 30, 2014 20:20
Making callback functions safe - I mean not fail catastrophically because not providing a function or array of functions
class window.SafeCallback
@arrayCallback: ( callback ) ->
if typeof callback == 'function'
console.log "SafeCallback: expected array, found function..."
return [ callback ]
if callback instanceof Array
console.log "SafeCallback: filtering functions from array..."
result = []
@ziyan-junaideen
ziyan-junaideen / retina_app.rb
Created May 6, 2014 20:11
Moneta Redis Sinatra Configuration - causes over 100 fragments per session storage in Redis
# Set rack options
use Rack::Session::Moneta, key: 'rack.session',
expire_after: 1800, # 30 mins
store: Moneta.new(:Redis, expires: true)
set nocompatible " be iMproved, required
filetype off " required
" set the runtime path to include Vundle and initialize
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
" alternatively, pass a path where Vundle should install plugins
"call vundle#begin('~/some/path/here')
execute pathogen#infect()
source 'https://rubygems.org'
group :default do # {{{
gem 'jekyll', "~> 2.4.0"
gem 'rake', "~> 10.3.2"
end # }}}
group :development do # {{{
gem 'rspec'
end # }}}
<form id="input-form" class="form-inline">
<div class="form-group">
<input id="input-handle" type="text" class="form-control" placeholder="Enter handle" autofocus />
</div>
<div class="form-group">
<input id="input-text" type="text" class="form-control" placeholder="Enter chat text here!" autofocus />
</div>
<button class="btn btn-primary" type="submit">Send</button>
</form>
<div class="page-header">
{% highlight ruby %}
require "rubygems"
require "tmpdir"
namespace :site do
desc "Generate blog files"
task :generate do
Jekyll::Site.new(Jekyll.configuration({
"source" => ".",
"destination" => "_site"
Deface::Override.new(
virtual_path: 'spree/admin/shared/_order_summary',
name: 'admin_order_custom_details',
insert_after: 'header#order_tab_summary > dl.additional-info',
partial: 'spree/admin/shared/admin_order_custom_details'
)
=> Booting WEBrick
=> Rails 4.0.8 application starting in development on http://0.0.0.0:3000
=> Run `rails server -h` for more startup options
=> Ctrl-C to shutdown server
WARN  DurableDecorator: Spree::Core::Search::Base#get_base_scope decoration uses an invalid SHA. The original method definition could have been tampered with!
WARN  DurableDecorator: Expected SHA was aa266a5b0825b2949bb4a0548b60734468339c8d but the provided SHA is 0030f517d06459bfcde9ae18157806c3b702a71f
Started GET "/products/black-white-layer-cake" for 127.0.0.1 at 2014-12-13 20:17:02 +0530
Processing by Spree::ProductsController#show as HTML
Deface::Override.new(
virtual_path: "spree/products/_properties",
name: "add_product_properties_container",
surround_contents: "erb[silent]:contains('unless')",
text: "<div id='product-info-container'><%= render_original %></div>"
)
// This styling is for salvatore plugin to work, this is more or less the config of
// the plugin
@media screen and (min-width: 1px) and (max-width: 767px){
#columns[data-columns]::before {
content: '2 .col-xs-6';
}
}
@media screen and (min-width:768px) and (max-width: 991px){
#columns[data-columns]::before {
content: '3 .col-sm-4';