Skip to content

Instantly share code, notes, and snippets.

$.ajax({
success: function(data) {
$('form').html(data['newDataParam']);
}
}
});
@rubinovitz
rubinovitz / vacation.py
Last active December 17, 2015 17:09
What to eat while on vacation
from random import choice
optionList = ["ice cream", "ice cream", "ice cream", "burrito", "banana", "ice cream"]
print choice(optionList)
@rubinovitz
rubinovitz / instagram_mine.py
Created August 27, 2013 00:00
A python script for downloading all of the instagram photos of a certain hashtag I wrote for a friend in 20 minutes (forgive sloppiness). Warning: you're only allowed 30 API requests an hour. Requires your own access token set as environment variable "access_token".
from datetime import datetime
import urllib2
import urllib
import json
import os
def ajaxRequest(url=None):
"""
Makes an ajax get request.
url - endpoint(string)
@rubinovitz
rubinovitz / sana.sh
Last active December 22, 2015 06:38
If Sana was a shell script...
while [ 0 ]
do
echo "Meow"
sleep 1
echo "Zzzz"
sleep 1
echo "JEN I CAN'T BELIEVE YOU WATCHED DEXTER WITHOUT ME AGAIN?!"
sleep 1
echo "guize, what if I left hackNY to be with my cats?"
sleep 1
@rubinovitz
rubinovitz / receiver.py
Created September 3, 2014 23:40
Building my own TCP client and sender for networking class!
#!/usr/bin/env python
"""
Receives a file via mock TCP over UDP
"""
import select
import socket
import sys
import struct
import hashlib
@rubinovitz
rubinovitz / gist:1614f88871f819564382
Created November 12, 2014 04:40
biomedical informatics halp
http://www.ncbi.nlm.nih.gov/Structure/mmdb/mmdbsrv.cgi?uid=17320
@rubinovitz
rubinovitz / gist:a4f724281e64359b22c5
Created April 19, 2015 22:46
app.js for node.js elasticbeanstalk
var express = require('express');
var morgan = require('morgan');
var compression = require('compression')
var app = express();
app.use(compression());
app.use(morgan('dev'));
// this is in milliseconds, because javascript -_-
var oneDay = 86400000;
@rubinovitz
rubinovitz / gist:277b3a2d5a20666d9f33
Created June 27, 2015 21:38
Crunchbase DDG Spice Scaffolding
package DDG::Spice::Crunchbase;
# ABSTRACT: Write an abstract here
# Start at https://duck.co/duckduckhack/spice_overview if you are new
# to instant answer development
import { createClient, RedisClientType } from "redis";
// Define a variable to hold the client instance
let client: RedisClientType | null = null;
export async function getRedisClient() {
if (client) {
// Return the existing client if it's already initialized
return client;
}
import {encodeAbiParameters, getContract, parseAbiParameters, createWalletClient, custom} from 'viem';
import {contract1155ImplementationAbi} from '../abi/generated';
const FIXED_PRICE_SALE_STRATEGY = '0x1Cd1C1f3b8B779B50Db23155F2Cb244FCcA06B21';
const mint = async () => {
// embedded is the embedded wallet from useWallets
const provider = await embedded.getEthereumProvider();
const [account] = await provider.request({
method: "eth_requestAccounts",