Skip to content

Instantly share code, notes, and snippets.

View yacafx's full-sized avatar
💭
Coding... 👽👾💻🕹

Sergio Brito yacafx

💭
Coding... 👽👾💻🕹
View GitHub Profile
@yacafx
yacafx / checkUserAgent.js
Created March 9, 2018 20:43
Check user agent in JS
// Check if user agent is from Apple
if(/iPad|iPhone|iPod/.test(navigator.userAgent)){
// actions
} else {
// Maybe is Android ;)
}
<h1>Poetry Workshops</h1>
<p>We will be conducting a number of poetry workshops and symposiums throughout the year.</p>
<p>Please note that the following events are free to members:</p>
<ul>
<li>A Poetic Perspective</li>
<li>Walt Whitman at War</li>
<li>Found Poems and Outsider Poetry</li>
</ul>
<table>
<tr>
@yacafx
yacafx / orderby.pipe.ts
Created January 3, 2018 00:30
Order by text or number for angular
import { Pipe, PipeTransform } from '@angular/core';
@Pipe({ name: 'orderBy' })
export class OrderBy implements PipeTransform {
transform(array, orderBy, asc = true) {
if (!orderBy || orderBy.trim() == "") {
return array;
}
@yacafx
yacafx / TopoJSON simplify.md
Last active November 18, 2017 06:20 — forked from frogcat/20170714.md
TopoJSON simplify demo

TopoJSON simplify demo

@yacafx
yacafx / http.conf
Created November 3, 2017 16:11
Apache configuration
# ----------------------------------------------------------------------
# Apache configuration file
# This file is best used in /apache2/httpd.conf, not use in .htaccess because works slower.
#
# Rules takes from:
# - HTML5BoilerPlate: https://github.com/h5bp/html5-boilerplate/
# - W3 Edge: http://www.w3-edge.com/
# - Yahoo! Best Practices: http://developer.yahoo.com/performance/rules.html
# - Caching Tutorial: http://www.mnot.net/cache_docs/
# ----------------------------------------------------------------------
cities: [
{ name: "Tokyo", coordinates: [139.6917,35.6895], population: 37843000 },
{ name: "Jakarta", coordinates: [106.8650,-6.1751], population: 30539000 },
{ name: "Delhi", coordinates: [77.1025,28.7041], population: 24998000 },
{ name: "Manila", coordinates: [120.9842,14.5995], population: 24123000 },
{ name: "Seoul", coordinates: [126.9780,37.5665], population: 23480000 },
{ name: "Shanghai", coordinates: [121.4737,31.2304], population: 23416000 },
{ name: "Karachi", coordinates: [67.0099,24.8615], population: 22123000 },
{ name: "Beijing", coordinates: [116.4074,39.9042], population: 21009000 },
{ name: "New York", coordinates: [-74.0059,40.7128], population: 20630000 },
@yacafx
yacafx / mx.json
Created October 11, 2017 17:22
Mx topo json
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@yacafx
yacafx / commit-msg
Created March 15, 2017 15:15
ESLint 3.0 Git Pre Commit Hook
#!/bin/bash
files=$(git diff --cached --name-only | grep '\.jsx\?$')
# Prevent ESLint help message if no files matched
if [[ $files = "" ]] ; then
exit 0
fi
failed=0
for file in ${files}; do
@yacafx
yacafx / convert-image-to-base64.js
Created November 4, 2016 11:27 — forked from HereChen/convert-image-to-base64.js
convert image to base64
/**
* version1: convert online image
* @param {String} url
* @param {Function} callback
* @param {String} [outputFormat='image/png']
* @author HaNdTriX
* @example
convertImgToBase64('http://goo.gl/AOxHAL', function(base64Img){
console.log('IMAGE:',base64Img);
})
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Collision 3D</title>
<link rel="stylesheet" href="../include/style.css">
</head>
<body>
<canvas id="canvas" width="400" height="400"></canvas>