Skip to content

Instantly share code, notes, and snippets.

View BastinRobin's full-sized avatar
🔬
Trying Odd's on daily basis ;)

Bastin Robin BastinRobin

🔬
Trying Odd's on daily basis ;)
View GitHub Profile
@BastinRobin
BastinRobin / list.js
Created June 21, 2015 13:48
Suming Column in JSON
// List of columns to sum
l = ["Reservations_Upgrades", "Reservations_Frequent_Flyer", "Reservations_seats", "Pre_Booking_price"];
// Convert csv to json
d3.csv('http://localhost:8000/dashboard/datalist/static/data1.csv', function(data) {
window.data = data;
});
// Adding total into data json
import json
import tornado.web
class JsonHandler(BaseHandler):
"""Request handler where requests and responses speak JSON."""
def prepare(self):
# Incorporate request JSON into arguments dictionary.
if self.request.body:
try:
@BastinRobin
BastinRobin / Email.txt
Created March 21, 2015 06:48
Generic Email List
1033edge.com
11mail.com
123.com
123box.net
123india.com
123mail.cl
123qwe.co.uk
150ml.com
15meg4free.com
163.com
<?php
// This creates a date string in the format YYYY-WNN, which is
// a four digit year followed by a hyphen and letter W then the
// two digit week number
$strtotime = date("o-\WW");
// The $start timestamp contains the timestamp at 0:00 on the
// Monday at the beginning of the week
$start = strtotime($strtotime);
@BastinRobin
BastinRobin / youtube.py
Created January 11, 2015 14:46
Youtube Scrapper
import pafy
url = raw_input ("Enter your URL : ")
# Instantiation
video = pafy.new (url)
#Users Choice
print "1 => Download || 2 => Extract"
choice = raw_input ( "Input d To Download or ei To Extract Information : ")
// Routes.php
Route::get('upload', function()
{
return View::make('upload-form');
});
Route::post('upload', function()
{
// Get and move uploaded file.
@BastinRobin
BastinRobin / Filter JSOn
Last active August 29, 2015 14:10
Sushant JSON
data = [
{
"Compound_id":133,
"Compound_name":"carbofuran",
"Protein_id":858,
"Protein_name":"CDs 1",
"Type":"possible",
"RScore":31,
"combination_id":"133_858"
},
/*
Taken and cribbed from blog.datalicious.com/free-download-all-australian-postcodes-geocod
May contain errors where latitude and longitude are off. Use at own non-validated risk.
*/
SET NAMES utf8;
SET sql_mode = 'NO_AUTO_VALUE_ON_ZERO';
DROP TABLE IF EXISTS postcodes_geo;
// takes the form field value and returns true on valid number
function valid_credit_card(value) {
// accept only digits, dashes or spaces
if (/[^0-9-\s]+/.test(value)) return false;
// The Luhn Algorithm. It's so pretty.
var nCheck = 0, nDigit = 0, bEven = false;
value = value.replace(/\D/g, "");
for (var n = value.length - 1; n >= 0; n--) {
@BastinRobin
BastinRobin / georadiusquery.php
Last active August 29, 2015 14:06
Geo Location Search Using Radius
public function getLocation() {
$lat = 37;
$lon = -122;
$radius = 40;
$result = Zipcode::select(
DB::raw("*,
( 3959 * acos( cos( radians(?) ) *
cos( radians( lat ) )
* cos( radians( lng ) - radians(?)
) + sin( radians(?) ) *