Skip to content

Instantly share code, notes, and snippets.

View samwx's full-sized avatar
💻
Coding

Samuel Martins samwx

💻
Coding
View GitHub Profile
@samwx
samwx / new_gist_file.js
Last active August 29, 2015 14:09
Load elements via Ajax
$(document).on("click", '.label-success', function(event) {
elemento = $(this);
$.ajax({
type: "POST",
url: "http://domain.com",
data: "my_data=" + elemento.parent().parent().attr('id'),
success: function(result){
elemento.parent().parent().hide().html(result).fadeIn('fast');
}
});
@samwx
samwx / css_resources.md
Created June 9, 2014 16:42 — forked from jookyboi/css_resources.md
CSS libraries and guides to bring some order to the chaos.

Libraries

  • 960 Grid System - An effort to streamline web development workflow by providing commonly used dimensions, based on a width of 960 pixels. There are two variants: 12 and 16 columns, which can be used separately or in tandem.
  • Compass - Open source CSS Authoring Framework.
  • Bootstrap - Sleek, intuitive, and powerful mobile first front-end framework for faster and easier web development.
  • Font Awesome - The iconic font designed for Bootstrap.
  • Zurb Foundation - Framework for writing responsive web sites.
  • SASS - CSS extension language which allows variables, mixins and rules nesting.
  • Skeleton - Boilerplate for responsive, mobile-friendly development.

Guides

@samwx
samwx / SumWeekends.php
Last active December 22, 2015 23:19
Function for sum weekends between two dates
<?php
function sumWeekends($start, $end) {
$start_date = strtotime($start);
$end_date = strtotime($end);
$n = floor(($end_date - $start_date) / 86400);
$n_weekends = ceil($n/7);
if (date("N", $start_date) == 6 && $n%7 == 0 ){
$n_weekends++;