Skip to content

Instantly share code, notes, and snippets.

View sajadtorkamani's full-sized avatar

Sajad Torkamani sajadtorkamani

View GitHub Profile
@sajadtorkamani
sajadtorkamani / sticky_footer.md
Created April 28, 2017 12:36
Clean CSS sticky footer
@sajadtorkamani
sajadtorkamani / redux_notes.md
Last active November 27, 2016 14:16
Redux notes
  • You write actions (plain objects) that describe what happens
  • You write reducers (pure functions) that specify how a given action transforms the state
  • You can subscribe to changes to the store via store.subscribe()
@sajadtorkamani
sajadtorkamani / attribute_validation.rb
Created June 26, 2016 15:55
RSpec - validate error on attribute
# Test that the :title attribute cannot be empty in the Note model
it "validates that title is present " do
note = Note.new(title: nil)
note.valid?
expect(note.errors).to include(:title)
end
- Make absolutely sure you're looking in the right place. Log some data where you'd expect it and confirm that it shows.
- Understand what code is supposed to do from the perspective of the User
- Check if the functionality is actually possible. Google or ask other devs=
@sajadtorkamani
sajadtorkamani / gist:1f9c87ffa9a774e6ec9c60725c6ceb8e
Created April 12, 2016 11:23
Using LESS on the command line
lessc --clean-css --autoprefix <source> <target>
<snippet>
<content><![CDATA[
\$alt = \$img->desc ?: ${1:\$item}->${2:navTitle};
]]></content>
<!-- Optional: Set a tabTrigger to define how to trigger the snippet -->
<tabTrigger>alt</tabTrigger>
<!-- Optional: Set a scope to limit where the snippet will trigger -->
<!-- <scope>source.python</scope> -->
</snippet>
<snippet>
<content><![CDATA[
<img src="<?= ${1:\$img}->src ?>" alt="<?= \$${2:alt} ?>" title="<?= \$${3:alt} ?>">
]]></content>
<!-- Optional: Set a tabTrigger to define how to trigger the snippet -->
<tabTrigger>saimg</tabTrigger>
<!-- Optional: Set a scope to limit where the snippet will trigger -->
<!-- <scope>source.python</scope> -->
</snippet>
{
"bold_folder_labels": true,
"color_scheme": "Packages/Colorsublime - Themes/Twilight.tmTheme",
"font_face": "Fira Code",
"font_options":
[
"gray_antialias"
],
"font_size": 13,
"ignored_packages":
@sajadtorkamani
sajadtorkamani / gist:c1a2deb1815dc7c2a726
Created October 8, 2015 14:44
Accessing a module argument Module('displays:misc:job-listing', array( 'title' => 'Sajad' ));
Module('displays:misc:job-listing', array(
'title' => 'Sajad'
));
<h1>Module Param: <?= $option['title'] ?></h1>
<!--[if lt IE 7]> <html class="ie ie6 lte9 lte8 lte7"> <![endif]-->
<!--[if IE 7]> <html class="ie ie7 lte9 lte8 lte7"> <![endif]-->
<!--[if IE 8]> <html class="ie ie8 lte9 lte8"> <![endif]-->
<!--[if IE 9]> <html class="ie ie9 lte9"> <![endif]-->
<!--[if gt IE 9]> <html> <![endif]-->
<!--[if !IE]><!--> <html> <!--<![endif]-->