Skip to content

Instantly share code, notes, and snippets.

View nebiros's full-sized avatar

Juan Alvarez nebiros

View GitHub Profile
@nebiros
nebiros / mb_str_pad.php
Created November 4, 2009 20:30
mb_str_pad
<?php
/**
* mb_str_pad
*
* @param string $input
* @param int $pad_length
* @param string $pad_string
* @param int $pad_type
* @return string
@nebiros
nebiros / Gemfile
Created May 23, 2012 15:58
rails + unicorn + rbenv + init.d daemon
group :production do
gem "unicorn"
end
@nebiros
nebiros / IndexController.php
Created January 28, 2010 13:13
Export data to excel on Zend Framework
<?php
class IndexController extends Zend_Controller_Action
{
public function exportXlsAction()
{
set_time_limit( 0 );
$model = new Default_Model_SomeModel();
$data = $model->getData();
@nebiros
nebiros / .htaccess
Created May 23, 2012 14:17
osx localhost apache's config
# ----------------------------------------------------------------------
# Gzip compression
# ----------------------------------------------------------------------
<IfModule mod_deflate.c>
# Force deflate for mangled headers developer.yahoo.com/blogs/ydn/posts/2010/12/pushing-beyond-gzipping/
<IfModule mod_setenvif.c>
<IfModule mod_headers.c>
SetEnvIfNoCase ^(Accept-EncodXng|X-cept-Encoding|X{15}|~{15}|-{15})$ ^((gzip|deflate)\s*,?\s*)+|[X~-]{4,13}$ HAVE_Accept-Encoding
import UIKit
enum LayoutableButtonVerticalAlignment: String {
case center
case top
case bottom
case unset
}
enum LayoutableButtonHorizontalAlignment: String {
const Hapi = require('@hapi/hapi');
const MongoClient = require('mongodb').MongoClient;
const server = Hapi.server({
port: 3000,
debug: {
request: ['*']
}
});
@nebiros
nebiros / main.go
Created April 9, 2020 20:08
[SOLVED] Write a minimal thread pool using go routines and channels
package main
import (
"encoding/json"
"fmt"
"io"
"io/ioutil"
"log"
"net/http"
"os"
@nebiros
nebiros / gist:9196645
Last active January 8, 2019 05:10
Send Push Notifications from node.js with Parse.com SDK
var Parse = require("parse").Parse;
Parse.initialize(
"", // applicationId
"", // javaScriptKey
"" // masterKey
);
var query = new Parse.Query(Parse.Installation)
, data = {
@nebiros
nebiros / Podfile
Created October 2, 2018 01:35
Set swift version for a specific pod
post_install do |installer|
installer.pods_project.targets.each do |target|
next unless %w[NonSwift42Pod].include? target.name
target.build_configurations.each do |config|
config.build_settings["SWIFT_VERSION"] = "4.0"
end
end
end
@nebiros
nebiros / _get_short_url.php
Created April 23, 2014 20:34
URL shortener using google's and CURL.
<?php
define("DEFAULT_URL_SHORTENER_API_URL", "https://www.googleapis.com/urlshortener/v1/url");
function _get_short_url($longUrl) {
$curl = curl_init();
$options = array(
CURLOPT_CONNECTTIMEOUT => 0,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_SSL_VERIFYPEER => false,