This file contains hidden or 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
command to insert: | |
r = Rating.create :user_id => 1, :product_id => 1, :description => 'I dont like this shirt', :rating => 2 | |
To run migration: | |
bin/rake db:migrate | |
To create anew migration for adding in reference columns : | |
bin/rails generate migration AddUserAndProductToRatings user:references product:references | |
Create a new model/migration |
This file contains hidden or 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
db.tweets.updateMany({ {"likes" : null},{$set: {"likes": []}} }) |
This file contains hidden or 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
db.tweets.findAndModify({query: {"likes" : null},update:{$set: {"likes": []}},new: true, upsert: true }) |
This file contains hidden or 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 pandas as pd | |
import os | |
import datetime | |
import numpy as np | |
#This will be the directory with all the sheets to combine. | |
questdir = 'C:\Users\chouw\Desktop\Load3' | |
#chunk of code to verify file count matches. | |
files = [] |
This file contains hidden or 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
from PIL import Image | |
from resizeimage import resizeimage | |
import os | |
dir = 'C:\Users\chouw\Documents\pictures' | |
for dirname,subdirlist,flist in os.walk(dir): | |
for fname in flist: | |
if fname.lower().endswith('.jpg'): | |
if os.stat(dir+"\\"+fname).st_size > 3000: | |
print "resize {}".format(fname), | |
with open(dir+"\\"+fname, 'r+b') as f: |
This file contains hidden or 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 os | |
import csv | |
import datetime | |
import timeit | |
import pandas as pd | |
import pickle | |
flcount = 0 | |
addcount = 0 | |
lastadded = 0 |
This file contains hidden or 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 wrapLog = function (callback, name) { | |
//var args = callback.apply(null,arguments); | |
//console.log(arguments); | |
//console.log(args); | |
//console.log(arguments[0]); | |
//console.log(arguments); | |
return function() { | |
//console.log(arguments); | |
//console.log(callback.apply(null,arguments)); | |
//var arg2 = 1, arg1 = 2; |
NewerOlder