Skip to content

Instantly share code, notes, and snippets.

View alisha's full-sized avatar
👩‍💻

Alisha Ukani alisha

👩‍💻
View GitHub Profile
<?hh
function workspace_prefs_to_db_rows(workspace_t $workspace, array<string, mixed> $prefs): array<db_workspaces_prefs_row_t> {
$pref_rows = [];
foreach ($prefs as $pref_name => $pref_value){
$new_pref = shape(
'workspace_id' => $workspace['id'],
'pref_name' => $pref_name,
'pref_value' => json_encode($pref_value),
<?hh
function workspaces_get_pref_stats_only_admins(workspace_t $workspace): bool {
# Logging with a low sample rate
if (mt_rand(1, 5000) == 7){
log_event('workspaces_prefs_get', array('pref_name' => 'stats_only_admins'));
}
$ret = workspaces_prefs_get_single_safe($workspace, 'stats_only_admins');
if ($ret->is_error()) throw new WorkspacePrefFetchException('Workspace pref fetch failure');

Goals

Specifically, we want to:

  • Report the percentage of students who receive jobs
  • Make a histogram for all applicants' travel times
  • Make a histogram of travel times for applicants who want to stay close to home
  • Report the percentage of applicants whose job matches their interests
  • Report the percentage of applicants whose job matches their interests if they wanted that more than proximity
@alisha
alisha / speaxter.rb
Created January 12, 2016 01:07
Use Twilio to let two friends communicate when one is texting and the other is calling
require 'twilio-ruby'
require 'sinatra'
# user 1 is texting
# user 2 is calling
ACCOUNT_SID = "..."
AUTH_TOKEN = "..."
TWILIO_PHONE_NUM = "+1..."
All community members are expected to:
* Act in a way that displays yourself as a positive role model.
* Be humble, even when you're successful.
* Respect, encourage, and support other students.
Additionally, whether at StudentRND events or not, community members are expected to:
* Not harass others.
private static int partition(int[] arr, int first, int last) {
int pivot = arr[(first + last)/2];
int i = first - 1; // index going left to right
int j = last + 1; // index going right to left
while (true) {
do {
i++;
} while (arr[i] < pivot);
do {
### Keybase proof
I hereby claim:
* I am alisha on github.
* I am alisha (https://keybase.io/alisha) on keybase.
* I have a public key whose fingerprint is 329F C097 65E3 A040 5B06 70F9 1975 1EFB 6957 8A86
To claim this, I am signing this object:
@alisha
alisha / crack.c
Created September 25, 2014 13:57
/**
* crack.c
*
* Alisha Ukani
*
* Cracks DES-encrypted passwords
*/
#define _XOPEN_SOURCE
#include <unistd.h>
@alisha
alisha / BogoSort.java
Created February 26, 2013 19:32
A program for BogoSort, a method that sorts an array by shuffling it if it is not sorted, and repeats until it is. Used as an example to show why it is important to have an efficient sorting algorithm.
//Alisha Ukani
//github.com/alishau
import java.util.Date;
public class BogoSort {
public static void main(String[] args) {
Date start = new Date(); //Saves time of when the program starts
int[] arr = generateArray(10);
System.out.println("Original array: ");
@alisha
alisha / WordGame.java
Created February 18, 2013 00:43
A simple game where two players try to create words from the phrase "Computer Science".
//By Alisha Ukani
//github.com/alishau
import java.io.File;
import java.util.ArrayList;
import java.util.Scanner;
public class WordGame {
public static void main(String[] args) {
//Dictionary source: github.com/atebits/Words