This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#import "snapApi.h" | |
#import <RestKit/RestKit.h> | |
#import "Profile.h" | |
@interface snapApi () | |
@property (nonatomic, strong) NSArray *profile; | |
@end | |
@implementation snapApi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Playground - noun: a place where people can play | |
// swift fibonacci number | |
// Justin Zollars | |
// jz.io | |
import Cocoa | |
var answer = fib(5) | |
func fib(start: Int) -> Int { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Hack | |
attr_accessor :possible, :array, :final_answer | |
def initialize | |
@possible = ["A","B","C","D"] | |
@array = [] | |
@final_answer = [] | |
self.generate | |
self.process_array | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class City | |
attr_accessor :cities, :connections, :path, :total_time, :next_city, :count, :run_count, :nodes | |
PathBegins = "sf" | |
EndingTime = 1440 # 24 hours * 60 | |
def initialize | |
@cities = ["bos", "nyc", "la", "sea", "jac", "chi", "phx", "med", "min", "gre", "oma", "dc", "mem", "den", | |
"abq", "dal", "dtw", "cha", "slc" ] | |
@connections = { | |
"sf"=>[["bos", 110], ["gre",32], ["slc", 23], ["la", 12], ["med",10]], |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
x = {"Alanine"=>7.4, "Arginine"=>4.2, "Asparagine"=>4.4, "Aspartic Acid"=>5.9, "Cystine"=>3.3, | |
"Glutamic Acid"=>5.8, "Glutamine"=>3.7, "Glycine"=>7.4, "Histidine"=>2.9, "Isoleucine"=>3.8, | |
"Leucine"=>7.5, "Lysine"=>7.2, "Methionine"=>1.8, "Phenylalanine"=>4.0, "Proline"=>5.0, | |
"Serine"=>8.0, "Threonine"=>6.2, "Tryptophan"=>1.3, "Tyrosine"=>3.3, "Valine"=>6.8, | |
"Stop Codons"=>0.1} | |
x.sort_by {|_key, value| value} | |
=>[["Stop Codons", 0.1], ["Tryptophan", 1.3], ["Methionine", 1.8], ["Histidine", 2.9], | |
["Tyrosine", 3.3], ["Cystine", 3.3], ["Glutamine", 3.7], ["Isoleucine", 3.8], ["Phenylalanine", 4.0], |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
x = {"Alanine"=>7.4, "Arginine"=>4.2, "Asparagine"=>4.4, "Aspartic Acid"=>5.9, "Cystine"=>3.3, | |
"Glutamic Acid"=>5.8, "Glutamine"=>3.7, "Glycine"=>7.4, "Histidine"=>2.9, "Isoleucine"=>3.8, | |
"Leucine"=>7.5, "Lysine"=>7.2, "Methionine"=>1.8, "Phenylalanine"=>4.0, "Proline"=>5.0, | |
"Serine"=>8.0, "Threonine"=>6.2, "Tryptophan"=>1.3, "Tyrosine"=>3.3, "Valine"=>6.8, | |
"Stop Codons"=>0.1} | |
# creates a sorted list of codons | |
sorted = x.sort_by {|_key, value| value} | |
=> [["Stop Codons", 0.1], ["Tryptophan", 1.3], ["Methionine", 1.8], ["Histidine", 2.9], ["Tyrosine", 3.3], |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
file_path = ARGV[0] | |
number_of_lines = ARGV[1] || 10 | |
answer = {} | |
number_of_lines = number_of_lines.to_i | |
if file_path.nil? | |
puts "you must include a file path" | |
else | |
File.open(file_path).each_with_index do |line, index| | |
answer[index] = line | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
format: | |
db.nia.find({"BUDGET_START":{$nin : ['', undefined]}}).forEach( function(obj) {if (typeof(obj.BUDGET_START)!='object') {var datePt = obj.BUDGET_START.split('/');var dateEn = datePt[2] + '-' + datePt[0] + '-' + datePt[1];obj.BUDGET_START = new ISODate(dateEn);db.nia.save(obj);}}); | |
then search: | |
db.nia.find({"BUDGET_START": {$gte: ISODate("2010-01-01T00:00:00.000Z"),$lt: ISODate("2010-12-30T00:00:00.000Z")}}).count() | |
ensure index: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var myApp = angular.module('myApp',[]); | |
myApp.controller('QuestionsController', ['$scope', '$http', function($scope, $http) { | |
var AUTH_TOKEN = $('meta[name=csrf-token]').attr('content'); | |
var user_id = "1" | |
console.log(AUTH_TOKEN); | |
$http.defaults.headers.common['X-CSRF-Token'] = AUTH_TOKEN; | |
$http.defaults.headers.post["Content-Type"] = "application/json"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
NH4 is (+1) (Oxidation number of N in NH4+ is -3 Oxidation number of each H in NH4+ is +1) | |
Ce is +3 | |
SO4 is -2 ( Oxidation number of S is +6 and O is -2 in SO4) | |
You have 2 polyatomic ions in this. NH4 and SO4 | |
NH4 is +1 (you will probably have to memorize common ions and this is very common.) Since NH4 is +1 you can look at each element individually. H is in group 1 (look across the periodic table. There are 8 long columns. Elements in group 1 tend to lose an electron. That makes them a positive number since they will have more protons than electrons. That would mean H is +1. N is in group 5. It usually is going to either lose 5 or gain 3. (All want 8 except for H and He that want 2). N must be negative to balance out the ion. Since H is +1 and you can see in NH4 that there are 4H's that means you have +4 for all the H in the ion. The ion totally is +1. 4 - 1= 3 So N gains electrons and is -3. | |
SO4 is a poly atomic ion that is -2. O and S are both in group 6. That means they want to lose 6 or gain 6. O is going |
OlderNewer