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
| require 'fastercsv' | |
| n = 0 | |
| FasterCSV.foreach("export_all_products.csv") do |row| | |
| if n != 0 | |
| puts "Adding new product: #{row[7]}" | |
| product = Product.new | |
| product.name = row[7] | |
| product.description = row[27] |
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
| <?php | |
| require_once 'app/Mage.php'; | |
| Mage::app(); | |
| mysql_connect(localhost, DATABASE_USER, DATABASE_PASSWORD); | |
| mysql_select_db(DATABASE_NAME) or die("Unable to select database"); | |
| $result = mysql_query("SELECT * FROM `catalog_product_entity_varchar` WHERE attribute_id in (74,75,76) AND value='no_selection'"); | |
| while ($row = mysql_fetch_array($result)) { |
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 geventwebsocket.handler import WebSocketHandler | |
| from gevent.pywsgi import WSGIServer | |
| from flask import Flask, request, render_template | |
| app = Flask(__name__) | |
| @app.route('/') | |
| def index(): | |
| return render_template('index.html') |
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
| funcAST, fset := parseFunc("../gooo.go", "main") | |
| fs := token.NewFileSet() | |
| node, _ := parser.ParseFile(fs, "../gooo.go", nil, 0) | |
| for _, decl := range node.Decls { | |
| if genDecl, ok := decl.(*ast.GenDecl); ok { | |
| if genDecl.Tok == token.VAR { | |
| for _, s := range genDecl.Specs { | |
| vSpec := s.(*ast.ValueSpec) | |
| for _, v := range vSpec.Names { | |
| //fmt.Printf("%T", v.Pos()) // token.Pos |
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
| func getFields() { | |
| t := reflect.TypeOf(model.Post{}) | |
| fmt.Printf("%v\n", t.Name()) | |
| for i := 0; i < t.NumField(); i++ { | |
| field := t.Field(i) | |
| fmt.Printf("%v\n", field.Name) | |
| } | |
| } | |
| func getInterfaces(file *ast.File) *ast.Field { |
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
| <!--Pattern HTML--> | |
| <div id="pattern" class="pattern"> | |
| <div class="c"> | |
| <h2>Page Title</h2> | |
| <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Praesent dictum odio eget mauris vestibulum feugiat. Praesent ante sapien, luctus pulvinar ultricies quis, aliquet in mi. Nulla facilisi. Donec malesuada fringilla iaculis. Praesent nec quam sit amet orci volutpat volutpat in eget eros. Duis pellentesque bibendum erat. Integer pretium nunc vel augue rutrum eget feugiat mi molestie. Cras venenatis, turpis et rhoncus scelerisque, mi augue suscipit urna, quis sagittis tortor nisl ut purus. Aliquam at enim est. Donec sit amet suscipit quam. Aliquam sit amet commodo eros.</p> | |
| <p>Proin quis dui eros. Morbi fringilla, ligula vitae interdum volutpat, est eros ultricies sem, vitae pellentesque lacus lorem vitae risus. In odio eros, placerat in fermentum sit amet, commodo eget magna. In suscipit velit pharetra neque consequat commodo congue risus eleifend. Aliquam tellus ligula, dapibus sed rutrum at, |
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
| ps aux | grep tmux | awk '{print $2}' | xargs sudo kill -9 |
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
| [\d]*\. | |
| # includes space afterwards |
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
| val postForm: Form[Post] = Form ( | |
| mapping( | |
| "name" -> nonEmptyText, | |
| "description" -> nonEmptyText, | |
| "group" -> ignored(Group.findOneByName("Test group").get.id), | |
| "updated" -> optional(date) | |
| )((name, description, group, updated) => Post(new ObjectId, name, description, Option(group), new java.util.Date, updated)) | |
| ((post: Post) => Some((post.name, post.description, post.group.get, post.updated))) | |
| ) | |
OlderNewer