Skip to content

Instantly share code, notes, and snippets.

View a-bx's full-sized avatar
I may be slow to respond.

Abraham Barrera a-bx

I may be slow to respond.
  • Migrante
  • Chile
View GitHub Profile
@a-bx
a-bx / gist:3612466
Created September 3, 2012 19:07
APS - Sending a notification
var noti = new apns.Notification();
var device = new apns.Device("DEVICE-TOKEN");
noti.sound = "notification.caf";
noti.alert = "Message here!!";
noti.payload = { }; //object with data if you want.
noti.device = device;
apnsConnection.sendNotification(noti);
@a-bx
a-bx / gist:3612627
Created September 3, 2012 19:26
APS - Generate PEM Files
$ openssl x509 -in aps_cert_development.cer -inform DER -outform PEM -out aps_cert_development.pem
$ openssl x509 -in aps_cert_production.cer -inform DER -outform PEM -out aps_cert_production.pem
$ openssl pkcs12 -in aps_key_development.p12 -out aps_key_development.pem -nodes
$ openssl pkcs12 -in aps_key_production.p12 -out aps_key_production.pem -nodes
@a-bx
a-bx / configure_php_on_mac_embed_apache.md
Created October 10, 2012 19:52
Configure PhP on Mac OSX embed Web Server
  • open /private/etc/apache2/httpd.conf file and enable module

    uncomment: LoadModule php5_module libexec/apache2/libphp5.so

  • copy /private/etc/php.ini.default to /private/etc/php

@a-bx
a-bx / install_pear_osx.md
Last active October 11, 2015 13:48
Install Pear on MacOSX

$ curl http://pear.php.net/go-pear.phar > go-pear.php

$ sudo php -q go-pear.php

  • Note: To install default configuration
  • Edit .bash_profile (or .bashrc) and add:

export PATH=/Users/username/pear/bin:$PATH

$ source ~/.bash_profile

@a-bx
a-bx / gist:4204247
Created December 4, 2012 14:06
Consultas Git
########################################
#
# GIT
#
########################################
# Mostrar commits que no se han pusheado:
$ git log origin/branch..branch
$ git log origin/master..HEAD
@a-bx
a-bx / TideSDK_Gemfile.rb
Last active December 17, 2015 18:59
TideSDK working with coffeescript, HAML, SAAS and Sprockets
source 'https://rubygems.org'
gem 'redcarpet', '1.17.2'
gem 'guard', '~> 1.8.0'
gem 'guard-haml', '~> 0.5'
gem 'guard-sass', '~> 1.1.0'
gem 'guard-coffeescript', '~> 1.3.0'
gem 'guard-sprockets'
gem 'guard-rocco'
@a-bx
a-bx / TideSDK_Guardfile.rb
Created May 27, 2013 15:07
TideSDK working with coffeescript, HAML, SAAS and Sprockets
guard 'sass', input: 'source/styles', output: 'Resources/styles'
guard 'haml', input: 'source', output: 'Resources' do
watch(/^.+(\.html\.haml)/)
end
guard 'rocco', :run_on => [:start, :change], :dir => 'docs', :stylesheet => 'https://raw.github.com/joeharris76/docco-css/master/nuvola.css' do
watch(%r{^source/scripts/.*\.(coffee)$})
end
# String extensions
class String
def cavgsify
gsub /ca([Z b-df-hj-np-tv-z]|[ ]|\Z)/, 'cavg\1'
end
def ochoafy
gsub /a/, 'aaaAaaaAaaaAaaaAaaaAaaaAaaaAaaaAaaaAaaaAaaaAaaaAaaaAaaaAaaaAaaaAaaaAaaaAaaaAaaaAaaaAaaaAaaaAaaaAaaaAaaaAaaaAaaaAaaaAaaaA'
end
@a-bx
a-bx / gist:a50beab969a1938b4764
Created April 23, 2015 19:30
GetOnBoard Scrapp
require 'mechanize'
def parse_offer(link, goal)
agent = Mechanize.new
agent.get link
salary = agent.page.search('[itemprop="baseSalary"]')
salary_value = salary.first.attributes['content'].value
dolars = salary_value.to_i
title = agent.page.search('[itemprop="title"]').first.text
return nil unless dolars >= goal
@a-bx
a-bx / enable-swap-ec2.sh
Created December 14, 2015 22:18
Enable swap ec2
# To add this extra space to your instance you type:
sudo /bin/dd if=/dev/zero of=/var/swap.1 bs=1M count=1024
sudo /sbin/mkswap /var/swap.1
sudo /sbin/swapon /var/swap.1
# If you need more than 1024 then change that to something higher.
# To enable it by default after reboot, add this line to /etc/fstab: