Skip to content

Instantly share code, notes, and snippets.

View dsignr's full-sized avatar

Neya dsignr

View GitHub Profile
@dsignr
dsignr / JQuery simple Tab Plugin.coffee
Last active July 18, 2018 13:11
A simple Coffeescript snippet to implement tabs easily in your application
###
Disclaimer:
This gist is opinionated. It favors the usage of dashes over underscores.
http://stackoverflow.com/questions/7560813/why-are-dashes-preferred-for-css-selectors-html-attributes
License:
Free, Opensource, MIT
http://opensource.org/licenses/MIT
Usage:
Your HTML should be something like:
@dsignr
dsignr / uri.js
Created June 25, 2014 16:45 — forked from jlong/uri.js
var parser = document.createElement('a');
parser.href = "http://example.com:3000/pathname/?search=test#hash";
parser.protocol; // => "http:"
parser.hostname; // => "example.com"
parser.port; // => "3000"
parser.pathname; // => "/pathname/"
parser.search; // => "?search=test"
parser.hash; // => "#hash"
parser.host; // => "example.com:3000"
@dsignr
dsignr / index.css
Created June 28, 2014 09:34
Responsive fluid squares
/*-- credits: http://jsfiddle.net/josedvq/38Tnx/ --*/
.square-box{
position: relative;
width: 50%;
overflow: hidden;
background: #4679BD;
}
.square-box:before{
content: "";
@dsignr
dsignr / gist:b372f74970525a38f3de
Created October 18, 2015 07:49 — forked from dhh/gist:1014971
Use concerns to keep your models manageable
# autoload concerns
module YourApp
class Application < Rails::Application
config.autoload_paths += %W(
#{config.root}/app/controllers/concerns
#{config.root}/app/models/concerns
)
end
end
@dsignr
dsignr / index.md
Created October 20, 2015 08:43 — forked from rstacruz/index.md
Rails models cheatsheet

Rails Models

Generating models

$ rails g model User

Associations

belongs_to

has_one

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
activate :blog do |blog|
blog.prefix = 'blog'
blog.defaultextension = '.markdown'
blog.sources = 'articles/{category}/{title}'
blog.permalink ='{category}/{title}'
blog.summary_separator = /(READMORE)/
blog.layout = '/blog/bloglayout'
blog.tagtemplate = 'tag.html'
blog.calendartemplate = 'calendar.html'
# Enable pagination
#http://stackoverflow.com/questions/4150782/using-yaml-with-variables
key : 'This is the foobar var : %{foobar}'
content = file['key']
modified_content = content % { :foobar => foobar }
@dsignr
dsignr / DataFrame to GML.ipynb
Last active November 23, 2022 20:09
A python script to extract data from CSV and convert it into Gephi compatible GML.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
def before_render(&block)
(@_before_render ||= []) << block
end
def render()
@_before_render.each(&:call)
end