Skip to content

Instantly share code, notes, and snippets.

View a-bx's full-sized avatar

Abraham Barrera a-bx

  • Migrante
  • Chile
View GitHub Profile
@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 / 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 / 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:3612393
Created September 3, 2012 19:01
APNS - Create Conncectino
var apns = require('apn');
var options = {
cert: __dirname + '/../config/keys/aps_cert_' + env + '.pem',
certData: null,
key: __dirname + '/../config/keys/aps_key_' + env + '.pem',
keyData: null,
gateway: env == 'production' ? 'gateway.sandbox.push.apple.com' : 'gateway.sandbox.push.apple.com',
port: 2195,
enhanced: true,
errorCallback: function(errorCode, note){
@a-bx
a-bx / using_universal_ws_client.js
Created June 13, 2012 14:21
Using Universal Websocket Client
//configure websocket servers
var ws_servers = [
{ host: "socket1.example.com",
port: "8080"},
{ host: "socket2.example.com",
port: "8080"}];
//connect to any server
//(recconect and time are optional)
WSClient = new RhybooWS({
@a-bx
a-bx / coolstrappiscool.js
Created May 16, 2012 14:44
Coolstrap is COOL
COOL.Boot = (function(coolstrap, undefined) {
return function() {
};
})(COOL);
[{
"type": "rhyboo.start",
"ts": "2012-05-02T21:21:19.592+0000",
"data": {
"tz": -240,
"nettype": "WIFI",
"osname": "iphone",
"un": "iPhone Simulator",
"osarch": "x86_64",
"osver": "5.0",
@a-bx
a-bx / copy_git.sh
Created March 8, 2012 14:40
Copy git repositories with all history
#Origin
$ git clone <origin repo>
$ cd <origin directory>
$ git remote rm origin
$ git filter-branch --subdirectory-filter ./ -- --all
$ git add .
$ git commit
$ pwd
#Target
@a-bx
a-bx / stopsopa.html
Created January 18, 2012 13:26
STOP SOPA
<a style=display:scroll;position:fixed;top:0px;right:0px;
href="http://americancensorship.org/" target="_blank">
<img style="border:0;" src="http://2.bp.blogspot.com/-vkrUQQf0oRk/TxSYo4vMEcI/AAAAAAAABh8/_pDXwiO49pc/s1600/stop-sopa-ribbon.png" />
</a>
@a-bx
a-bx / uiwebview_zoom.m
Created December 13, 2011 16:02
How to reset UIWebView's zoom
UIScrollView *sv = nil;
// if iOS5 the scrollView property exists!
if ([self.webView respondsToSelector:@selector(scrollView)])
sv = webView.scrollView;
else
sv = [webView.subviews objectAtIndex:0];
CGSize theSize = [sv contentSize];