Skip to content

Instantly share code, notes, and snippets.

View yuigoto's full-sized avatar
🔧
working on amazing projects and tools

Fabio Goto yuigoto

🔧
working on amazing projects and tools
View GitHub Profile
@mathewbyrne
mathewbyrne / slugify.js
Created October 12, 2011 04:34
Javascript Slugify
function slugify(text)
{
return text.toString().toLowerCase()
.replace(/\s+/g, '-') // Replace spaces with -
.replace(/[^\w\-]+/g, '') // Remove all non-word chars
.replace(/\-\-+/g, '-') // Replace multiple - with single -
.replace(/^-+/, '') // Trim - from start of text
.replace(/-+$/, ''); // Trim - from end of text
}
@Ocramius
Ocramius / User.php
Last active July 24, 2024 14:38
Doctrine 2 ManyToMany - the correct way
<?php
use Doctrine\ORM\Mapping as ORM;
use Doctrine\Common\Collections\ArrayCollection;
/**
* @ORM\Entity()
* @ORM\Table(name="user")
*/
class User
@felipesabino
felipesabino / ColorConverter.js
Created March 1, 2013 17:38
Javascript color conversion RGB, CMYK and HSV source from http://www.webtoolkit.info/javascript-color-conversion.html
/**
*
* Javascript color conversion
* http://www.webtoolkit.info/javascript-color-conversion.html
*
**/
function HSV(h, s, v) {
if (h <= 0) { h = 0; }
if (s <= 0) { s = 0; }
@ambethia
ambethia / SVGExample.hx
Created March 9, 2013 17:24
Example SVG rendering in Haxe/NME. Because I will forget how to do this later.
import nme.Assets;
import nme.display.Shape;
import nme.display.Sprite;
import format.SVG;
class SVGExample extends Sprite
{
var svg:SVG;
var shape:Shape;
<?php
/*
* WordPress Breadcrumbs
* author: Dimox
* version: 2019.03.03
* license: MIT
*/
function dimox_breadcrumbs() {
/* === OPTIONS === */
@eyston
eyston / controller.js
Created June 24, 2013 17:11
angular typeahead
angular.module('ymusica').controller('AlbumSearch', ['$scope', 'Albums', 'Artists', '$q', function($scope, albums, artists, $q) {
$scope.albums = [];
$scope.artists = [];
var terms = new Rx.Subject();
$scope.searchMusic = terms.onNext.bind(terms);
terms.sample(250)
@erikhenrique
erikhenrique / bin-cc.md
Last active June 30, 2024 22:14
Bin de cartões de crédito para validação

Validação para cartão de crédito.

Bin e padrões para validação de cartão de crédito.

Bandeira Começa com Máximo de número Máximo de número cvc
Visa 4 13,16 3
Mastercard 5 16 3
@CMCDragonkai
CMCDragonkai / angularjs_directive_attribute_explanation.md
Last active November 29, 2023 15:35
JS: AngularJS Directive Attribute Binding Explanation

AngularJS Directive Attribute Binding Explanation

When using directives, you often need to pass parameters to the directive. This can be done in several ways. The first 3 can be used whether scope is true or false. This is still a WIP, so validate for yourself.

  1. Raw Attribute Strings

    <div my-directive="some string" another-param="another string"></div>
@mxriverlynn
mxriverlynn / 1.js
Last active October 6, 2017 01:04
node modules problems
var foo = require("../../../lib/foo");
var bar = require("../../../lib/bar");
var baz = require("../../../lib/baz");
var quux = require("../../../lib/quux");
@JamesMGreene
JamesMGreene / gitflow-breakdown.md
Last active July 19, 2024 01:24
`git flow` vs. `git`: A comparison of using `git flow` commands versus raw `git` commands.

Initialize

gitflow git
git flow init git init
  git commit --allow-empty -m "Initial commit"
  git checkout -b develop master

Connect to the remote repository