Skip to content

Instantly share code, notes, and snippets.

/* Flatten das boostrap */
.well, .navbar-inner, .popover, .btn, .tooltip, input, select, textarea, pre, .progress, .modal, .add-on, .alert, .table-bordered, .nav>.active>a, .dropdown-menu, .tooltip-inner, .badge, .label, .img-polaroid {
-moz-box-shadow: none !important;
-webkit-box-shadow: none !important;
box-shadow: none !important;
-webkit-border-radius: 0px !important;
-moz-border-radius: 0px !important;
border-radius: 0px !important;
border-collapse: collapse !important;
background-image: none !important;
@alansparrow
alansparrow / cart.rb
Last active December 27, 2015 09:59
app/models/cart.rb
class Cart < ActiveRecord::Base
has_many :line_items, dependent: :destroy
def add_product(product_id)
current_item = line_items.find_by(product_id: product_id)
if current_item
current_item.quantity += 1
else
current_item = line_items.build(product_id: product_id)
end
@alansparrow
alansparrow / SST Essay 1
Created November 8, 2013 07:16
Essay 1
Success may come from what seems to be the craziest ideas. The twelve-year-old boy in this story would be the prime example of that statement. At that time, since life so hard and poor that children hardly had a decent toy to play, the boy decided to sell his self-made toy ships and get money to buy "his dream"-an radio-controlled car. With his skillful hands and creative mind, he disassembled his broken toy cars to get tiny motors, and then put them on pieces of foam to make new toys which could travel on water surface. Those toys were simple but so interesting that most of his neighboring children owned one. Each toy ship brought him 2000 to 5000 VND (Vietnamese currency) depending on its size and decoration. His sale was a big success but when the boy saved almost enough for the radio-controlled car, he was out of components. He intended to quit the business and asked his parents for the rest of money, but they rejected him. They said: “You’d better pursue your goal until the end instead of giving up". Af
@alansparrow
alansparrow / color.m
Created November 11, 2013 00:21 — forked from kylefox/color.m
/*
Distributed under The MIT License:
http://opensource.org/licenses/mit-license.php
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
@alansparrow
alansparrow / How to use Bootstrap 3 with Rails 4
Created November 12, 2013 13:32
How to use Bootstrap 3 with Rails 4
Actually you don't need gem for this, here is the step to install Bootstrap 3 in RoR
Download Bootstrap
Copy bootstrap/dist/css/bootstrap.css and bootstrap/dist/css/bootstrap.min.css to vendor/assets/stylesheets
Copy bootstrap/dist/js/bootstrap.js and bootstrap/dist/js/bootstrap.min.js to vendor/assets/javascripts
Update app/assets/stylesheets/application.css
*= require bootstrap
Update app/assets/javascripts/application.js
#include <stdio.h>
#include <stdlib.h>
typedef int Edge;
typedef int Vertex;
int numberOfVertices = 0;
int currentComponentNumber = 0;
Edge **edges = NULL;
Vertex *vertices = NULL;
%{= kw}%-w%{= BW}%n %t%{-}%+w %-= @%H - %LD %d %LM - %c
import java.net.*;
import java.io.*;
import java.util.*;
/*
* The Client that can be run both as a console or a GUI
*/
public class Client {
// for I/O
import java.io.*;
import java.net.*;
import java.text.SimpleDateFormat;
import java.util.*;
/*
* The server that can be run both as a console application or a GUI
*/
public class Server {
// a unique ID for each connection