Skip to content

Instantly share code, notes, and snippets.

View khannotations's full-sized avatar

Rafi Khan khannotations

View GitHub Profile
vr = Program.create!({
name: "Virtual Reality Course",
description: "Design and build your own world. Learn the foundations of 3D modeling, scene building, animation, and coding in VR. Topics include Unity, object-oriented programming, 3D scene composition, 3D interactions, the Unity Asset Store, and more. ",
program_type: :course,
status: :active,
})
period = Period.current.order(:start_date).second
Session.create!({
# heroku run rails c -a ixjourney | tee file_to_export_to.csv
require 'csv'
ActiveRecord::Base.logger.level = 1
puts; puts;
puts "iX ID, first name, last name, email, phone, current city, university, graduation year, facebook, signed up at, state, references"
csv_string = CSV.generate do |csv|
User.applicants.includes(:university, { referred_by_references: :linkable }).order(:created_at).each do |applicant|
state = if applicant.applicant_valid_as?(User::AsInterviewedApplicant)
# Indented fields are self-explanatory; we have to decide what to do about non-indented fields.
t.integer "university_id"
t.string "first_name"
t.string "last_name"
t.string "graduation_year"
t.date "birthday"
t.string "major"
t.string "gender"
t.string "home_city"
t.string "current_city"
var app = angular.module("myApp", ["ngRoute", "firebase"]); // <-- angularfire
app.config(function($routeProvider) {
$routeProvider.when("/", {
controller: "HomeCtrl",
templateUrl: "/templates/home.html",
}).when("/signup", {
controller: "SignupCtrl",
templateUrl: "/templates/signup.html",
});
<div class="container">
<div class="row">
<div class="col-md-4 col-md-offset-4">
<h1>HELLOOO!!</h1>
<form ng-submit="signUpWithEmail()">
<input type="email" ng-model="newUser.email" class="form-control">
<input type="password" ng-model="newUser.password" class="form-control">
<input type="submit" value="Sign up!" class="btn btn-danger">
</form>
<div class="btn btn-info btn-block" ng-click="signInWithFacebook()">Sign in with FB whatup</div>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Happy stuff</title>
</head>
<!-- camelCase -->
<!-- this_is_snake_case -->
<!-- this-is-kebeb-case -->
<!-- THIS_IS_SCREAMING_SNAKE_CASE -->
<div class="container">
<div class="row">
<div class="col-md-4 col-md-offset-4">
<h1>My happy stuff</h1>
<!-- {{posts}} -->
<ol>
<li ng-repeat="post in posts">
<a href="http://reddit.com/{{post.data.permalink}}">{{post.data.title}}</a>
</li>
</ol>
var app = angular.module("myApp", ["ngRoute"]);
app.config(function($routeProvider) {
$routeProvider.when("/", {
controller: "HomeCtrl",
templateUrl: "/templates/home.html",
});
});
@khannotations
khannotations / rafi_markov_snakes_ladders.py
Last active January 22, 2016 19:21
Rafi's Solution to the HackerRank Problem "Markov Snakes and Ladders"
#!/usr/bin/python
# For hackerrank.com/challenges/markov-snakes-and-ladders
# Uses a simulation. Other possible solutions could use probabilities simply
# compute the answer.
import fileinput
from random import random
class Board:
def __init__(self, slides):
@khannotations
khannotations / template.html
Created November 14, 2012 01:54
Standard html template (for HackYale, 2012)
<!DOCTYPE HTML>
<html lang="en-US">
<head>
<meta charset="UTF-8">
<title>My Title</title>
<!-- Favicon icon -->
<link rel="shortcut icon" type="image/x-icon" href="./images/zebracon.jpg">
<!-- Including Twitter Bootstrap for easier styling.