Skip to content

Instantly share code, notes, and snippets.

View djom202's full-sized avatar

Jonathan Olier djom202

View GitHub Profile
@djom202
djom202 / index.js
Last active July 18, 2016 13:56
Angular los console logs en Dev
(function() {
var IS_DEV = true;
if (window.console && console.log) {
var oldFnLog = console.log;
console.log = function() {
IS_DEV && oldFnLog.apply(this, arguments);
}
}
})();
@djom202
djom202 / connStatus.js
Created June 9, 2016 22:30
Verify Status Internet
window.connStatus = {
_status: null,
waitForChange: function(_callback) {
this.getState();
this.updateState(_callback);
return this;
},
updateState: function(_callback) {
console.log('Init setInterval');
setInterval(function() {
@djom202
djom202 / gulpfile.js
Created June 7, 2016 22:13 — forked from jbarrus/gulpfile.js
protractor coverage support with gulp and istanbul (not tested, this is just extracted from larger files to demonstrate how to get protractor coverage working)
var istanbul = require('istanbul'),
gulp = require('gulp'),
istanbul = require('gulp-istanbul');
gulp.task('js', function() {
return gulp.src('js')
.pipe(istanbul({
includeUntested: true,
coverageVariable: '__coverage__'
}))
<?php
/**
* ImageManager.php
* A wrapper around GD that does multiple operations like, resizing, rotating,
* cropping and stuff.
*
* @author Michael Pratt <[email protected]>
* @version 1.0
* @link http://www.michael-pratt.com/
* @demo http://www.michael-pratt.com/Lab/imageManager/
<?php
class Logger
{
protected $file;
public function __construct($file) { $this->file = $file; }
public function log($message)
{
$message = date('H:i:s ') . $message . PHP_EOL;
SELECT id, nombre, (6371 * ACOS(
SIN(RADIANS(lat)) * SIN(RADIANS(4.6665578))
+ COS(RADIANS(lng - -74.0524521)) * COS(RADIANS(lat))
* COS(RADIANS(4.6665578))
)
) AS distance
FROM direcciones
HAVING distance < 1 /* 1 KM a la redonda */
ORDER BY distance ASC
@djom202
djom202 / breakpoints.scss
Created January 8, 2016 13:53
Create breakpoints to scss
/* BREAKPOINTS */
$break-big: "screen and (min-width:1660px)";
$break-large: ""; // Default
$break-medium: "screen and (min-width:461px) and (max-width:768px)";
$break-small: "screen and (max-width:460px)";
$break-smaller: "screen and (max-width:768px)";
/* MINIX */
@djom202
djom202 / autoload_classmap.php
Last active January 7, 2016 15:43
Auto Reading Class to Composer
<?php
// autoload_classmap.php @generated by Composer
$vendorDir = dirname(dirname(__FILE__));
$baseDir = dirname($vendorDir);
// Auto reading Class
$n = array();
foreach (glob($vendorDir . '/my_vendor_path/*.php') as $k => $v) {
@djom202
djom202 / verify.txt
Created December 14, 2015 13:27
Using simple comparison is less ambiguous, faster and cleaner.
isset is_null ===null ==null empty
null | F | T | T | T | T |
unset | F | T | T | T | T |
"" | T | F | F | T | T |
[] | T | F | F | T | T |
0 | T | F | F | T | T |
false | T | F | F | T | T |
true | T | F | F | F | F |
1 | T | F | F | F | F |
\0 | T | F | F | F | F |
@djom202
djom202 / index.html
Created September 8, 2015 19:03
QUnit (Pruebas Unitarias en Js)
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
<link rel="stylesheet" type="text/css" href="http://code.jquery.com/qunit/qunit-1.19.0.css" media="all" />
</head>
<body>
<div class="testing">
<div id="qunit"></div>