This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Server from 'server'; | |
import Logger from 'logger'; | |
import Slack from 'slackNotifier'; | |
import sinon from 'sinon'; | |
it('should log startup errors and send them to slack', () => { | |
sinon.spy(Logger, 'logException'); | |
Slack.notify = sinon.spy(() => {}); | |
Server.create({ port: 5000 }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Server from 'server'; | |
import Queue from 'queueWorker'; | |
import Resizer from 'fileResizer'; | |
Server.create({ port: 5000 }); | |
Queue.create({ port: 5001 }); | |
Resizer.create({ port: 5002 }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<section class="related_projects"> | |
<h2>Related Projects</h2> | |
{projects_related} | |
{if projects_related:no_results} | |
There are no related projects. | |
{/if} | |
{if projects_related:count == "1"} | |
<ul class="slats"> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function tailrec($func) | |
{ | |
$acc = array(); | |
$recursing = FALSE; | |
$func = new ReflectionFunction($func); | |
return function() use ($func, &$acc, &$recursing) { | |
$acc[] = func_get_args(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Welcome extends CI_Controller { | |
protected $user = 'github'; | |
public function __construct() | |
{ | |
parent::__construct(); | |
$this->load->helper('url'); | |
$this->load->spark('restclient/2.0.0'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
ini_set('display_errors', true); | |
class Car | |
{ | |
private $make; | |
public function __construct($make) | |
{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// sorta like manual profiling. | |
// peek into your jquery method calls to see why they are being called so much | |
// usage: | |
// $.logCallsTo('append'); | |
// $.logCallsTo('curCSS',true); | |
// output: | |
// http://gyazo.com/40cec25d875a7a767e95fd7a2f451b32.png |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Ajax Queue Plugin | |
* | |
* Original Homepage: http://jquery.com/plugins/project/ajaxqueue | |
* Original Documentation: http://docs.jquery.com/AjaxQueue | |
*/ | |
jQuery.ajaxQueue = function(o){ | |
var _old = o.complete; | |
o.complete = function(){ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var apps = $('#applications'); | |
var off_top = apps.offset().top; | |
apps.css({ | |
position: 'absolute', | |
top: off_top | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oauth basics for JR: | |
The goal is to give a third party app authenticated access to your api using a token in place of a user's credentials. | |
To do that, the third party app first gets a consumer key and secret from your app. These are used to sign all requests, so no other third party can pretend to be that service. | |
The same thing needs to happen for individual users. Here it gets a little more complicated. The third party app first gets a request token for that user. This is used in all requests so we know who we're dealing with. | |
Once they have a request token for that user they redirect him/her to your authentication page (passing the token along in the url). The user logs in to your app and approves the third party service. Your app then sends them back to the third party. At this point the third party application knows that the user is ok with giving them access to their data. | |
NewerOlder