Skip to content

Instantly share code, notes, and snippets.

View cyakimov's full-sized avatar
🏠
Working from home

Carlos Yakimov cyakimov

🏠
Working from home
  • Falabella
  • Santiago, Chile
View GitHub Profile
@cyakimov
cyakimov / gist:6456518
Created September 5, 2013 21:34
Allow apache user to exec a git pull command.

Change your PHP to run git via sudo

<?php `sudo git pull [email protected]:my-user/myrepo.git`; ?>

Then change your suoders to allow git to be run by the apache user:

nano /etc/sudoers

Add this to the EOF:

/*
name: [File.Upload, Request.File]
description: Ajax file upload with MooTools.
license: MIT-style license
author: Matthew Loberg
requires: [Request]
provides: [File.Upload, Request.File]
credits: Based off of MooTools-Form-Upload (https://github.com/arian/mootools-form-upload/) by Arian Stolwijk

How to use a PS3 controller on Mac OS X 10.7 (Lion)

  1. Open Apple menu -> System Preferences -> Bluetooth and disable Bluetooth on Mac as well as any other nearby Macs or devices which will try to pair with and confuse the controller.

  2. Reset PS3 controller by inserting paperclip into pinhole near L2 button.

  3. Connect PS3 controller to Mac with USB cable.

  4. Enable Bluetooth.

@cyakimov
cyakimov / sublime-settings
Created June 12, 2013 19:57
Sublime Text Settings
{
"auto_complete_commit_on_tab": false,
"bold_folder_labels": true,
"caret_style": "solid",
"color_scheme": "Packages/Color Scheme - Default/Monokai.tmTheme",
"create_window_at_startup": false,
"ensure_newline_at_eof_on_save": true,
"file_exclude_patterns":
[
".DS_Store"
@cyakimov
cyakimov / Steps to take
Created October 20, 2012 19:13 — forked from gerritwessels/Steps to take
Mac OSX Mountain Lion Brew, Nginx, PHP53 + FPM Setup & Configuration
Thanks to:
http://realityloop.com/blog/2012/07/03/nginx-mariadb-php-aegir-mac-os-x-optional-drush-5-works-mountain-lion
and
http://robots.thoughtbot.com/post/27985816073/the-hitchhikers-guide-to-riding-a-mountain-lion
--Fresh install Mountain Lion.
--Install XCode 4.4.2
--Install Command line utilities via Xcode
--Install Homebrew
@cyakimov
cyakimov / gist:2117219
Created March 19, 2012 15:59
Animate numbers jQuery
//http://stackoverflow.com/questions/149055/how-can-i-format-numbers-as-money-in-javascript
Number.prototype.formatMoney = function(c, d, t){
var n = this, c = isNaN(c = Math.abs(c)) ? 2 : c, d = d == undefined ? "," : d, t = t == undefined ? "." : t, s = n < 0 ? "-" : "", i = parseInt(n = Math.abs(+n || 0).toFixed(c)) + "", j = (j = i.length) > 3 ? j % 3 : 0;
return s + (j ? i.substr(0, j) + t : "") + i.substr(j).replace(/(\d{3})(?=\d)/g, "$1" + t) + (c ? d + Math.abs(n - i).toFixed(c).slice(2) : "");
};
function animateNumberChange(el,number,callback, interval, relax_interval)
{
var currentVal = el.data("value");
var endVal = number;
@cyakimov
cyakimov / gist:1171968
Created August 25, 2011 21:09
Install NodeJS in CentOS / Fedora
yum groupinstall "Development Tools"
#get the lastest in nodejs.org
wget http://nodejs.org/dist/node-v0.4.11.tar.gz
tar xvzf node-v0.4.11.tar.gz
cd node-v0.4.11
./configure && make && make install
@cyakimov
cyakimov / gist:1147517
Created August 15, 2011 19:24
HTML5 in IE8 and below
<meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1" />
<!--[if lt IE 9]>
<script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
@cyakimov
cyakimov / nodejs.sh
Created August 13, 2011 20:06 — forked from crcastle/nodejs.sh
Node.js startup script for AWS EC2 Linux box
#!/bin/bash
# nodejs - Startup script for node.js server
# chkconfig: 35 85 15
# description: node is an event-based web server.
# processname: node
# server: /path/to/your/node/file.js
# pidfile: /var/run/nodejs.pid
#
@cyakimov
cyakimov / gist:1139981
Created August 11, 2011 15:49
Decode Facebook signed_request with NodeJS
//npm install b64url
//A signed_request for testing:
//WGvK-mUKB_Utg0l8gSPvf6smzacp46977pTtcRx0puE.eyJhbGdvcml0aG0iOiJITUFDLVNIQTI1NiIsImV4cGlyZXMiOjEyOTI4MjEyMDAsImlzc3VlZF9hdCI6MTI5MjgxNDgyMCwib2F1dGhfdG9rZW4iOiIxNTI1NDk2ODQ3NzczMDJ8Mi5ZV2NxV2k2T0k0U0h4Y2JwTWJRaDdBX18uMzYwMC4xMjkyODIxMjAwLTcyMTU5OTQ3NnxQaDRmb2t6S1IyamozQWlxVldqNXp2cTBmeFEiLCJ1c2VyIjp7ImxvY2FsZSI6ImVuX0dCIiwiY291bnRyeSI6ImF1In0sInVzZXJfaWQiOiI3MjE1OTk0NzYifQ
function parse_signed_request(signed_request, secret) {
encoded_data = signed_request.split('.',2);
// decode the data
sig = encoded_data[0];
json = base64url.decode(encoded_data[1]);
data = JSON.parse(json); // ERROR Occurs Here!