Skip to content

Instantly share code, notes, and snippets.

View clecidor's full-sized avatar
🎯
Focusing

Clay Clecidor clecidor

🎯
Focusing
View GitHub Profile
#!/bin/bash
#
# bash < <(curl -s https://gist.github.com/jmervine/5407622/raw/nginx_w_lua.bash)
# Adapted from http://mervine.net/nginx-with-lua-module
# REQUIREMENT - uncomment if PCRE library is not already installed
# apt-get install libpcre3 libpcre3-dev
set -x
@clecidor
clecidor / User.php
Last active August 29, 2015 14:16
create_users_table.php
<?php
use Illuminate\Auth\UserTrait;
use Illuminate\Auth\UserInterface;
use Illuminate\Auth\Reminders\RemindableTrait;
use Illuminate\Auth\Reminders\RemindableInterface;
use Reimy\Extensions\Html\UserFormTraits;
class User extends BaseModel implements UserInterface, RemindableInterface {
@clecidor
clecidor / jquery.viewports.js
Created March 19, 2015 15:10
jquery.viewports.js adds css classes to <body> element based on browser's viewport size
(function($) {
if (!$) return; // bail if no jQuery
function initViewportJs() {
var bodyElement = $('body');
function checkViewportJS(evt) {
var bodyWidth = parseInt(bodyElement.css('width'));
if (!bodyWidth) return false;
@clecidor
clecidor / sum_even_fibonacci.js
Last active July 27, 2018 05:09
sum_even_fibonacci.js - Find the sum-total of even Fibonacci numbers
/**
* Find the sum-total of even Fibonacci numbers
*
* @param max - (integer) that specifies the maximum term to count up to (cannot exceed 4 million)
*
* Example:
* sum_even_fibonacci(2) -> 2
* sum_even_fibonacci(8) -> 10
* sum_even_fibonacci(34) -> 44
*/
@clecidor
clecidor / oscillate.js
Last active September 13, 2019 07:32
oscillate.js
function oscillate(intervals, threshhold) {
intervals = intervals || (-1*intervals) || 1;
threshhold = threshhold || (-1*threshhold) || 1;
const distance = threshhold * 2;
const minute = 60;
const rateOfChange = (distance / minute);
console.log({ intervals, threshhold, distance, rateOfChange });
@clecidor
clecidor / circle.js
Created September 14, 2019 08:56
circle.js
function circle(radius) {
radius = radius || (-1*radius) || 1;
const quadrant1 = [];
const quadrant2 = [];
const quadrant3 = [];
const quadrant4 = [];
const DEGREE = radius / 90;
for(let x=0; x <= radius; x+=DEGREE) {
fetch('https://backend.otcmarkets.com/otcapi/market-data/active/current?page=1&pageSize=1000').then((res) => res.json()).then(({ records }) => {
const keys = [ 'symbol', 'item', 'itemDesc', 'tierId', 'tierName', 'tierCode', 'price', 'tradeCount', 'dollarVolume', 'shareVolume' ].join(',');
const values = records.map(r => [ r.symbol, r.item, r.itemDesc, r.tierId, r.tierName, r.tierCode, r.price, r.tradeCount, r.dollarVolume, r.shareVolume ].join(','));
console.log([].concat(keys, values).join("\n"));
}).catch(console.log)