Skip to content

Instantly share code, notes, and snippets.

View jesuscast's full-sized avatar

Andres Castaneda jesuscast

View GitHub Profile
@jesuscast
jesuscast / bestFit.py
Last active August 29, 2015 14:05
Given a set of x values and y values, this functions returns another function with the best fit line
def LFIT(x,y):
N = len(x)
if N != len(y):
return 0
Sx = sum(x)
Sy = sum(y)
Sx2 = sum([n**2 for n in x])
Sxy = sum([x[i]*y[i] for i in range(N)])
b = (N*Sxy-Sx*Sy)/(N*Sx2-Sx**2)
a = (Sy-b*Sx)/N
@jesuscast
jesuscast / sqrt-of-two.py
Created September 2, 2014 01:20
Calculates the sqrt of 2 with exaggerate precision
from decimal import *
getcontext().prec = 100
def powerSeries(A,N, precision):
a = Decimal(A)
n = Decimal(N)
power = Decimal(0)
total = Decimal(0)
for i in range(precision):
totalLocal = Decimal(1)
nTotal = Decimal(0)
@jesuscast
jesuscast / pi.py
Created September 9, 2014 17:52
Calculates pi
from decimal import *
getcontext().prec = 100
def calcPi(precision):
sign = 1.0
denominator = 1
sum = Decimal(0.0)
for i in range(precision):
sum += Decimal(1.0)/Decimal(denominator)*Decimal(sign)
sign = -sign
import numpy as np
x = np.array([0.0,1.0,2.0])
y = np.array([0.0,0.8,0.9])
z = np.polyfit(x,y,3)
p = np.poly1d(z)
y2 = [ p(N) for N in x ]
print str(y2[0])
How to run cordova on linux for my specific computer only.
This is only a memo for myself.
First of all using user jesus:
go to
cd ~/Android/Sdk/tools
./android avd
and let that run
URL:
http://3c25fbaf.ngrok.io/
Screens in order:
Index:
http://3c25fbaf.ngrok.io/index.html
Login:
/*
?>
<!-- Slider
================================================== -->
<div class="slider-wrapper">
<?php
if ( is_active_sidebar( 'he-main-slider' ) ) {
?>
<div class="menu-top-wrapper">
<video autoplay="" loop="" poster="img/cover-background.png" id="bgvid" class="stretchToFit" style="">
<source src="http://executive.inncubator.net/wp-content/uploads/2015/10/video21.mp4" type="video/mp4">
<source src="http://executive.inncubator.net/wp-content/uploads/2015/10/video2.webm" type="video/webm">
</video>
<img class="ls-l ls-preloaded" id="image-in-header" style="top: 266.5px; left: 680.5px; white-space: nowrap; width: 479px; height: 67px; padding: 0px; border-width: 0px; visibility: visible; margin-left: 0px; margin-top: 0px; transform-origin: 50% 50% 0px; transform: matrix3d(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, -0.002, 0, 0, 0, 1); opacity: 1;" data-ls="offsetxin:0;durationin:2500;offsetxout:0;" src="http://www.inncubator.net/wp-content/uploads/2015/04/tag.png" data-src="http://www.inncubator.net/wp-content/uploads/2015/04/tag.png" alt="">
<p id="button-in-header" class="ls-l" style="top: 369px; left: 825px; white-
@jesuscast
jesuscast / obtain_match.js
Last active November 7, 2015 00:07
Algorithm to match two lawyers in the Youth in Government application
var obtainMatch = function() {};
$(document).ready(function(){
// List of all judges. Make sure those specific strings are used when assigning judges to
// the users
judgesWhoPresideFB = ["judge 1", "judge 2", "judge 3"];
// List of all judges. Make sure those specific strings are used when assigning judges to
// the users
judgesWhoScoreFB = ["judge 1", "judge 2", "judge 3"];
@jesuscast
jesuscast / examples.py
Last active November 22, 2015 20:34
Really good examples of exposing class decorators. Taken from bottle.py Nothing here makes sense it is just for me to remember how to write some code.
+route = functools.wraps(Bottle.route)(lambda *a, **ka: app().route(*a, **ka))
+get = functools.wraps(Bottle.get)(lambda *a, **ka: app().get(*a, **ka))
+post = functools.wraps(Bottle.post)(lambda *a, **ka: app().post(*a, **ka))
+put = functools.wraps(Bottle.put)(lambda *a, **ka: app().put(*a, **ka))
+delete = functools.wraps(Bottle.delete)(lambda *a, **ka: app().delete(*a, **ka))
+error = functools.wraps(Bottle.error)(lambda code: app().error(code))
def route(self, path=None, method='GET', **kargs):
""" Decorator: Bind a function to a GET request path.