Skip to content

Instantly share code, notes, and snippets.

View azinazadi's full-sized avatar

Azin A azinazadi

View GitHub Profile
@azinazadi
azinazadi / sftp_parallel.py
Created April 1, 2022 20:14
python sftp client to download files from remote in concurrent threads
import os
from threading import Thread
from time import sleep
import pysftp
from stat import S_IMODE, S_ISDIR, S_ISREG
def get_r_portable(remotedir, localdir, num_threads = 10):
print(remotedir)
@azinazadi
azinazadi / _atoms.sass
Created December 6, 2015 22:03
handy sass file to generate a lot of usefull atomic css rules
=def-classes($attr, $values...)
@each $val in $values
.#{$attr}-#{$val}
#{$attr}: #{$val}
@each $d in 0,1,2,4,8,16
@each $attr in margin, padding
.#{$attr}-#{$d}, .childs-#{$attr}-#{$d} > *
#{$attr}: #{$d}em
@azinazadi
azinazadi / Vertical Dividers between Columns.markdown
Created July 23, 2015 10:27
Vertical Dividers between Columns
# nonlinear scrolling of idea attachments
# we want to make it like the scrolling pauses on each attachment
# for this we create an empty wrapper with the same width, height and use a fixed positioning for attachments container
# this way we can freely decide where to position them based on window's scroll position, and the wrapper will keep the
# preserved space in the document
$(window).on 'scroll', ->
container = $('.nonlinear-scroll')
wrapper = $('.nonlinear-scroll-wrapper')
breathePoints = $('.nonlinear-scroll-breathe-point')
@azinazadi
azinazadi / fui_boolean_input.rb
Created February 23, 2014 10:54
flat ui checkbox helper for simple_form. use :as => :fui_boolean
class FuiBooleanInput < SimpleForm::Inputs::BooleanInput
self.default_options = {:input_html => {'data-toggle' => "checkbox"}, :inline_label => true, :label => false}
def nested_boolean_style?
true
end
end
@azinazadi
azinazadi / 0_selector_hacks.scss
Created February 22, 2012 10:22 — forked from chriseppstein/0_selector_hacks.scss
This gist demonstrates some uses of the new sass feature: Passing content blocks to mixins.
@mixin ie6 { * html & { @content } }
#logo {
background-image: url("/images/logo.png");
@include ie6 { background-image: url("/images/logo.gif"); }
}
@azinazadi
azinazadi / rails_cheatsheet.md
Created November 17, 2011 11:21 — forked from taktran/rails_cheatsheet.md
Rails cheatsheet

An incomplete cheatsheet for rails 3. Things are added as they are required.

Active Record validations

# http://guides.rubyonrails.org/active_record_validations_callbacks.html

class SomeClass < ActiveRecord::Base

  # length
@azinazadi
azinazadi / formtastic.rb
Created November 17, 2011 11:19
formtastic cheatsheet
more: https://github.com/justinfrench/formtastic
-> make form for all db columns
<%= semantic_form_for @user do |f| %>
<%= f.inputs %>
<%= f.buttons %>
<% end %>
-> select cols
<%= semantic_form_for @user do |f| %>
'
rails 1.9 new hash syntax
new_hash = {simon: "Talek", lorem: "Ipsum"}
###Rspec
%cucumber
save_and_open_page
###MIGRATION