Skip to content

Instantly share code, notes, and snippets.

View renesansz's full-sized avatar
🎯
Focusing

Renemari Padillo renesansz

🎯
Focusing
View GitHub Profile
@renesansz
renesansz / vhosts.conf
Last active August 29, 2015 14:17
Basic vhost file
# Change * or port 80 as needed
<VirtualHost *:80>
DocumentRoot "path\to-nowhere"
ServerName your-server-name-here # Sample: mywebsite.com
<Directory "path\to-nowhere">
Options Indexes FollowSymLinks Includes ExecCGI
AllowOverride All
Require all granted
</Directory>
@renesansz
renesansz / sample-chart.js
Created March 30, 2015 00:37
Sample implementation for Chart.js
var ctx = document.getElementById("graph").getContext("2d");
var data = {
labels: ["2011", "2012", "2013"],
datasets: [
{
label: "Trainer Score",
fillColor: "rgba(220,220,220,0.2)",
strokeColor: "rgba(220,220,220,1)",
pointColor: "rgba(220,220,220,1)",
pointStrokeColor: "#fff",
// Includes functions for exporting active sheet or all sheets as JSON object (also Python object syntax compatible).
// Tweak the makePrettyJSON_ function to customize what kind of JSON to export.
var FORMAT_ONELINE = 'One-line';
var FORMAT_MULTILINE = 'Multi-line';
var FORMAT_PRETTY = 'Pretty';
var LANGUAGE_JS = 'JavaScript';
var LANGUAGE_PYTHON = 'Python';
function doGet(request) {
var output = ContentService.createTextOutput();
var data = {};
var id = request.parameters.id;
var sheet = request.parameters.sheet;
var ss = SpreadsheetApp.openById(id);
if (sheet) {
data[sheet] = readData_(ss, sheet);
} else {
// Grab all sheets except those with a name
@renesansz
renesansz / key-press-listener.js
Last active September 8, 2015 14:09
Key Press Listener for JavaScript
'use strict';
(function(window){
/**
* Function: Keydown
*
* Manipulate keypress actions.
*
* Parameters:
@renesansz
renesansz / mouse-wheel-listener.js
Created April 16, 2015 12:14
Mouse wheel listener for JavaScript.
'use strict';
(function(window) {
//
// Manipulate Mouse Wheel
// source: http://www.adomas.org/javascript-mouse-wheel/index.html
//
/**
* Function: MouseWheelEvent
@renesansz
renesansz / append_digest.js
Created June 29, 2015 10:20
Append HTML string with ng-digest
$scope.link = function($elementRoot, element){
$elementRoot.append($compile(element)($scope));
$scope.$digest($elementRoot);
};
ListLessonsCtrl.link($scrollPane.find('.jspPane'),
'<div class="btn-lesson {{lesson.buttonColor}}" ng-repeat="lesson in lessons[\'' + day.id + '\'] track by $index|orderBy:lesson.created_at" ' +
'ng-init="lessonIdx = $index">' +
'<a class="btn btn-default" ng-click="showLessonSummary($index, \'' + day.id + '\')" onclick="preventExpand = true">' +
'{{lesson.name}} <div class="stud-ratio gone">| {{lesson.studTaken}} / {{lesson.studCount}}</div>' +
@renesansz
renesansz / LocalStorage.js
Last active October 20, 2015 08:32
Local Storage Service Provider
/**
* Angular App Factory: LocalStorage
*/
(function() {
'use strict';
angular.module('app.factories')
.factory('LocalStorage', LocalStorage);
@renesansz
renesansz / SharedData.js
Last active October 26, 2015 20:14
Shared Data Service Provider
/**
* Angular App Factory: SharedData
*/
(function () {
'use strict';
angular.module('app.services')
.service('SharedData', SharedData);
@renesansz
renesansz / DecimalToRoman.js
Created July 14, 2015 15:14
Decimal to Roman Numeral Converter
function DecimalToRoman(num) {
if (num <= 0 || num >= 4000) return num;
var roman = ["M","CM","D","CD","C","XC","L","XL","X","IX","V","IV","I"];
var decimal = [1000,900,500,400,100,90,50,40,10,9,5,4,1];
var romanStr = '';
for (var i = 0, limit = roman.length; i < limit; ++i) {
while (num >= decimal[i]) {