Skip to content

Instantly share code, notes, and snippets.

@coldhawaiian
coldhawaiian / gist:bc3379289f905086ea2f
Created October 16, 2015 12:29 — forked from jferguson/gist:1681888
Usage of SqlBulkCopy a Generic List<T>
var imports = new List<Product>();
//Load up the imports
//Pass in cnx, tablename, and list of imports
BulkInsert(context.Database.Connection.ConnectionString, "Products", imports);
@coldhawaiian
coldhawaiian / gist:443fc9c4a868b01595b5
Created October 16, 2015 12:29 — forked from jferguson/gist:1681480
SqlBulkCopy Generic List<T>
public static void BulkInsert<T>(string connection, string tableName, IList<T> list)
{
using (var bulkCopy = new SqlBulkCopy(connection))
{
bulkCopy.BatchSize = list.Count;
bulkCopy.DestinationTableName = tableName;
var table = new DataTable();
var props = TypeDescriptor.GetProperties(typeof(T))
//Dirty hack to make sure we only have system data types

vimdiff cheat sheet

##git mergetool

In the middle file (future merged file), you can navigate between conflicts with ]c and [c.

Choose which version you want to keep with :diffget //2 or :diffget //3 (the //2 and //3 are unique identifiers for the target/master copy and the merge/branch copy file names).

:diffupdate (to remove leftover spacing issues)

:only (once you’re done reviewing all conflicts, this shows only the middle/merged file)

Business Models

Advertising

Models Examples
Display ads Yahoo!
Search ads Google
@coldhawaiian
coldhawaiian / answer.md
Created July 10, 2014 18:35
Deleted SO Answer for User

Question

HI, I've recently started emploment at a company that uses JCAPS to perform intrgrational development. Does anyone have any tutorials i can use?

Answer

Take a look at the following links:

The introduction to Reactive Programming you've been missing

(by @andrestaltz)

So you're curious in learning this new thing called (Functional) Reactive Programming (FRP).

Learning it is hard, even harder by the lack of good material. When I started, I tried looking for tutorials. I found only a handful of practical guides, but they just scratched the surface and never tackled the challenge of building the whole architecture around it. Library documentations often don't help when you're trying to understand some function. I mean, honestly, look at this:

Rx.Observable.prototype.flatMapLatest(selector, [thisArg])

Projects each element of an observable sequence into a new sequence of observable sequences by incorporating the element's index and then transforms an observable sequence of observable sequences into an observable sequence producing values only from the most recent observable sequence.

@coldhawaiian
coldhawaiian / osx.sh
Created June 24, 2014 18:33
Iterate all Git projects
# http://stackoverflow.com/a/24390169/456814
for x in *; do git --work-tree="$x" --git-dir="$x/.git" status; done
for x in *; do
git --work-tree="$x" --git-dir="$x/.git" status
done
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Copyright (C) 2014 ADDY OSMANI <addyosmani.com>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
#Model
@user.should have(1).error_on(:username) # Checks whether there is an error in username
@user.errors[:username].should include("can't be blank") # check for the error message
#Rendering
response.should render_template(:index)
#Redirecting
response.should redirect_to(movies_path)