Skip to content

Instantly share code, notes, and snippets.

View reyramos's full-sized avatar
💭
Check out my Gitlab Instead

Rey Ramos reyramos

💭
Check out my Gitlab Instead
View GitHub Profile
@reyramos
reyramos / killport
Created May 14, 2014 19:00
Killport on linux (ubuntu)
#!/bin/sh
PNUMPER=$1;
kill -9 `lsof -w -n -i tcp:$PNUMPER| awk '{print $2}'|awk 'END{print}'`;
@reyramos
reyramos / fb.js
Created June 4, 2014 18:35
Facebook with requirejs
define(['facebook'], function(){
FB.init({
appId: 'YOUR_APP_ID'
, status: true
, cookie: true
, xfbml: true
, version : 'v2.0'
});
FB.getLoginStatus(function(response) {
console.log(response);
@reyramos
reyramos / example.js
Created June 4, 2014 18:38
Example stream.publish api
var attachment = {
'name':'My Super Cool Website'
,'description':'This is a test of the Facebook Broadcast System. If this was real, you would be reading something useful.'
,'media':[
{
'type':'image'
,'src':'http://superman-header.jpg'
,'href':'http://superman-header.jpg'
}
]
@reyramos
reyramos / jsConsole.js
Created June 13, 2014 14:48
script to detect IOS devices to run jsconsole, BECAREFUL do not load this on production
(function(window){
var key = "ee0256032e288b780f41513765b59254";
var ua = window.navigator ? window.navigator.userAgent :
window.request ? window.request.headers['user-agent'] : 'No User Agent'
var isMobile = {
Android: function () {
return ua.match(/Android/i);
@reyramos
reyramos / autoload.php
Last active August 29, 2015 14:04
PHP autoloader script, using SPL_AUTOLOAD_REGISTER.Just set the $dir, path relative from the autoloader file, optional exclude array for files not to include in the autoloader.It will include all files with namespace, others will be ignored.namespace follow PSR-0 standard, If using phpunit * phpunit --bootstrap autoload.php [testFile]
<?php
/**
*
* PHP autoloader script, using SPL_AUTOLOAD_REGISTER.
* It will include all files with namespace, others will be ignored.
*
* namespace follow PSR-0 standard
*
* If using phpunit
* phpunit --bootstrap autoload.php [testFile]
var http = require("http"),
url = require("url"),
path = require("path"),
fs = require("fs")
port = process.argv[2] || 8888;
http.createServer(function(request, response) {
var uri = url.parse(request.url).pathname
, filename = path.join(process.cwd(), uri);
@reyramos
reyramos / angular.console
Created February 6, 2015 20:08
Call Angular Services from console.
angular.element(document.body).injector().get('serviceName')
@reyramos
reyramos / gitlab.conf
Created February 16, 2015 15:25
Git lab config on Apache2.4
#This configuration has been tested on GitLab 6.0.0 and GitLab 6.0.1
#Note this config assumes unicorn is listening on default port 8080.
#Module dependencies
# mod_rewrite
# mod_proxy
# mod_proxy_http
# Put this after the other LoadModule directives
LoadModule proxy_module /usr/lib/apache2/modules/mod_proxy.so
@reyramos
reyramos / Preferences.sublime-settings
Created March 18, 2015 20:43
Preferences.sublime-settings
{
"font_size": 9,
"ignored_packages":
[
"Vintage",
"SublimeCodeIntel"
],
"open_files_in_new_window": false
}
@reyramos
reyramos / Package Control.sublime-settings
Created March 18, 2015 20:43
Package Control.sublime-settings
{
"in_process_packages":
[
],
"installed_packages":
[
"AngularJS",
"AngularJS Snippets",
"Code Snippets Helper",
"CSS Format",