Skip to content

Instantly share code, notes, and snippets.

View srph's full-sized avatar
πŸ› οΈ
Building @Stride-Labs Frontend

Kier Borromeo srph

πŸ› οΈ
Building @Stride-Labs Frontend
View GitHub Profile
@srph
srph / columnDisplayDropdown.js
Created October 25, 2014 07:34
[AngularJS] columnDisplay
+(function(angular, _, undefined) {
function columnDisplayDropdown() {
var scope, template;
// onColumnChange - a callback function
// when the columns change
// columns - column data
scope = {
columns: '=',
onColumnChange: '&'
@srph
srph / baseCtrl.js
Created October 25, 2014 07:44
[AngularJS] base ctrl
+(function(angular, _, undefined) {
function BaseIndexCtrl($scope) {
$scope.onColChange = function() {
localStorageService.set('residents', $scope.columns);
};
}
angular
.module('app')
.controller('BaseIndexCtrl', BaseIndexCtrl);
@srph
srph / childCtrl.js
Created October 26, 2014 19:11
[AngularJS Controller Inheritance]: "this" not pointing to the child controller
+(function(angular, undefined) {
function ScholarshipsCtrl($scope, $state, $controller, Scholarship, UtilService, SCHOLARSHIP_COLUMNS) {
// Initialize variables
var vm = this,
controller,
// Assigns this variable to
// the data assigned by the resolve to the service
collection = [],
columns,
storage,
@srph
srph / Pogi.php
Last active August 29, 2015 14:08
PHP - Getter example | Getting a pogi, example.
<?php
/**
* Usage:
* $pogi = new Pogi('Kier');
* echo $pogi->getName();
*/
class Pogi {
/**
@srph
srph / sample-usort.php
Created November 12, 2014 09:49
usort php
function sort($a, $b) {
// If a's contributions is equal to b's contributions,
// return 0, indicating "as it is"
if ( $a->contributions == $b->contributions ) {
return 0;
}
// If a is less than b, put it before b. Otherwise, the opposite
return $a->contributions < $b->contributions ? -1 : 1;
}
@srph
srph / views.md
Last active August 29, 2015 14:09
laravel view structure
β”œβ”€β”€ dashboard/
|	β”œβ”€β”€ $layout/
|	β”œβ”€β”€ members/
|	|	β”œβ”€β”€ index.blade.php
|	|	β”œβ”€β”€ create.blade.php
|	|	β”œβ”€β”€ edit.blade.php
|	β”œβ”€β”€ projects/
|	|	β”œβ”€β”€ index.blade.php
|	|	β”œβ”€β”€ create.blade.php
var CountdownControl = React.createClass({
// Simplified for brevity
render: function() {
var control = this.props.status
? 'Pause'
: 'Resume';
return (
<span onClick={this._handleClick}>
@srph
srph / CountdownControl.js
Created November 21, 2014 00:11
[AngularJS] basic countdown. angular version of (https://gist.github.com/srph/fcd27d3e87a483b26ee9)
'use strict';
angular
.module('app')
.directive('CountdownControl', CountdownControl);
function CountdownControl() {
var template = [
'<span ng-click="controlCtrl.toggleTick()">',
'{{ controlCtrl.state }}',
@srph
srph / kier-pogi
Created November 22, 2014 21:55
Personal ASCII text aart (http://patorjk.com/software/taag/)
__ .__ .__
| | _|__| ___________ ______ ____ ____ |__|
| |/ / |/ __ \_ __ \ \____ \ / _ \ / ___\| |
| <| \ ___/| | \/ | |_> > <_> ) /_/ > |
|__|_ \__|\___ >__| | __/ \____/\___ /|__|
\/ \/ |__| /_____/
@srph
srph / sample.json
Last active August 29, 2015 14:10
Sample JSON data taken from Thinking In React (http://facebook.github.io/react/docs/thinking-in-react.html)
[
{
"category": "Sporting Goods",
"price": "$49.99 ",
"stocked": true,
"name": "Football"
},
{
"category": "Sporting Goods",
"price": "$9.99",