Skip to content

Instantly share code, notes, and snippets.

View arzola's full-sized avatar
:octocat:
Coding

Oscar Arzola arzola

:octocat:
Coding
View GitHub Profile
<?xml version="1.0"?>
<ruleset name="PSR2">
<description>The PSR-2 coding standard.</description>
<arg name="tab-width" value="4"/>
<!-- 2. General -->
<!-- 2.1 Basic Coding Standard -->
<!-- Include the whole PSR-1 standard -->
@arzola
arzola / gist:7fd49d153f2837c0313e3c50c655d304
Created February 11, 2017 20:17 — forked from chrisle/gist:2252209
CURL as GoogleBot 2.1
curl --user-agent "Googlebot/2.1 (+http://www.google.com/bot.html)" -v $@
@arzola
arzola / RefactorToCollection.php
Last active June 23, 2017 21:35
Refactor to collection
$tweets = Datostwitter::orderBy('hora', 'desc')->take(Settings::get('twitter_max'))->get();
$pagetweets = [];
$total = count($tweets);
$itemtw = [];
for ($i = 0; $i < $total; $i+=5){
for ($n = 0; $n < 5; $n++){
if (isset($tweets[$i+$n])){
@arzola
arzola / entrans
Created November 25, 2014 16:42
End Transition
$("#list_container").on("transitionend webkitTransitionEnd oTransitionEnd MSTransitionEnd", function (e) {
if (e.target == this) {
tpListingSearchResults.shuffleObj.shuffle('layout');
}
});
@arzola
arzola / regex_replace
Created November 5, 2014 00:32
Regex to convert coordinates string to Google Maps Points
//str example
-87.6361173230483,41.9184733663886,0 -87.63625063290191,41.9186879407643,0 -87.63638917236651,41.9188946307294,0 -87.63638597726001,41.9196072396054,0 -87.63640288658171,41.9201768975391,0 -87.6364176789852,41.9206761120529,0 -87.6364281700465,41.921033421017,0 -87.6364463383626,41.9216235169182,0 -87.636450850147,41.921817693737,0 -87.63645747855981,41.9219928494608,0 -87.6364639198159,41.9221636969844,0 -87.6364641782462,41.9221721963153
(-\d\d\.+(\d)*)+,(\d\d\.+(\d)*)+,(0)
Regex replace
new google.maps.LatLng($1,$3),
@arzola
arzola / singletonobj
Created September 12, 2014 17:11
Singleton Objetive C
+ (SPProgress *)sharedInstance {
static dispatch_once_t pred;
static SPProgress *shared = nil;
dispatch_once(&pred, ^{
shared = [[SPProgress alloc] init];
shared.eneArray = [[NSMutableArray alloc]init];
});
return shared;
}
@arzola
arzola / ajaxjquery
Created September 11, 2014 22:12
ajax Jquery
$.ajax({
url: '/url',
data: params,
type: 'post',
dataType: 'json',
success: function(response) {
},
error: function(response) {
@arzola
arzola / isnumeric
Created September 11, 2014 22:11
isNumeric Javascript
function isNumber(evt) {
evt = (evt) ? evt : window.event;
var charCode = (evt.which) ? evt.which : evt.keyCode;
return (charCode <= 31 || charCode === 46 || (charCode >= 48 && charCode <= 57));
}
@arzola
arzola / embed_image
Created May 19, 2014 22:47
Add Embed Image with PhpMailer
<?php
$mail->AddEmbeddedImage("rocks.png", "my-attach", "rocks.png");
$mail->Body = 'Your <b>HTML</b> with an embedded Image: <img src="cid:my-attach"> Here is an image!';
@arzola
arzola / topView
Created March 21, 2014 05:34
Add Top Border to UIView
CALayer *TopBorder = [CALayer layer];
TopBorder.frame = CGRectMake(0.0f, 0.0f, self.scrollView.frame.size.width, 1.0f);
TopBorder.backgroundColor = UIColorFromRGB(0xff716b).CGColor;
[self.scrollView.layer addSublayer:TopBorder];