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 / 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++;
@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 / 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');
}
});
import java.util.Scanner;
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
/**
*
* @author Samuel Martins
@samwx
samwx / new_gist_file.less
Created May 24, 2016 13:33
Rulesets for LESS
@placeholder-ruleset: { text-transform: uppercase; };
.placeholder(@color-01, @placeholder-ruleset);
/**/
.placeholder(@color, @ruleset: {}) {
::-webkit-input-placeholder {
color: @color;
@ruleset();
}
@samwx
samwx / tslint.json
Created September 29, 2017 18:47
tslint suggestion
{
"rules": {
"class-name": true,
"comment-format": [
true
],
"curly": true,
"eofline": true,
"forin": true,
"indent": [
@samwx
samwx / typescript.json
Last active May 30, 2018 20:12
Userful angular snippets for vscode
{
"Create angular es7 module": {
"prefix": "ng-module",
"body": [
"import * as angular from 'angular';",
"",
"// Types",
"",
"// Controllers",
"",
@samwx
samwx / components.js
Created November 19, 2017 17:42
angularjs module distribution
(function(angular){
angular.module('blip.components', [])
.component('component1', {
template: '<span>{{ $ctrl.name }}</span>',
bindings: {
name: '@',
}
})
.component('component2', {
template: '<span>{{ $ctrl.name }} 2</span>',