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
| my_list = list(range(1000000)) | |
| for i in range(100): | |
| other_list = [elem for elem in my_list] |
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
| s[999],*r=s,*d,c;main(a,b){char*v=1[d=b];for(;c=*v++%93;)for(b=c%7?a&&(c&17?c&1? | |
| (*r-=c-44):(r+=c-61):c&2?putchar(*r):(*r=getchar()),0):v;b&&c|a**r;v=d)main(!c,& | |
| b-1);d=v;} |
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
| context = { | |
| :person => { | |
| :name => "Melissa", | |
| :friends => [ | |
| {:name => "Chris"}, | |
| {:name => "Tom"}, | |
| {:name => "PJ"} | |
| ] | |
| } | |
| } |
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 pystache | |
| >>> from pystache import view | |
| >>> | |
| >>> class Dummy(view.View): | |
| ... pass | |
| ... | |
| >>> context = {'icecream': lambda flavor: "%s icecream" % flavor, 'title': 'Yummy'} | |
| >>> template = "** {{title}}\n\n {{#icecream}}Strawberry{{/icecream}}" | |
| >>> | |
| >>> context2 = dict(context.items()) |
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
| function ispis(pis) { | |
| pis = pis.toString(); | |
| var weight = [3, 2, 9, 8, 7, 6, 5, 4, 3, 2]; | |
| var sum = 0, digito = 0; | |
| if (pis.length != 11 || pis.match(/\D/)) | |
| return false; | |
| pis = pis.split(""); | |
| for (var i=0; i < 10; i++) | |
| sum += weight[i] * pis[i]; | |
| digito = 11 - (sum % 11); |
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
| # In-memory Cassandra-ish thingy... useful for unit tests. Maybe useful for other | |
| # stuff too? No support for SuperColumns, but that should be easy enough to add. | |
| import bisect | |
| import copy | |
| from cassandra.ttypes import NotFoundException, Column, ColumnPath, ColumnOrSuperColumn | |
| class SSTable(object): |
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
| # Author: Pieter Noordhuis | |
| # Description: Simple demo to showcase Redis PubSub with EventMachine | |
| # | |
| # Requirements: | |
| # - rubygems: eventmachine, thin, cramp, sinatra, yajl-ruby | |
| # - a browser with WebSocket support | |
| # | |
| # Usage: | |
| # ruby redis_pubsub_demo.rb | |
| # |
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
| #!/bin/bash | |
| if [ $# -ne 1 ]; then | |
| echo "Usage: vipy <python module>" | |
| exit 1 | |
| fi | |
| MODULE_LOCATION=`python -c "import $1; print $1.__file__.rstrip('c')"` | |
| if [ -z $MODULE_LOCATION ]; then |
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
| <select id="most_common_languages" name="most_common_languages"> | |
| <option value="Afrikaans">Afrikaans</option> | |
| <option value="Arabic">Arabic</option> | |
| <option value="Bulgarian">Bulgarian</option> | |
| <option value="Bengali">Bengali</option> | |
| <option value="Bosnian">Bosnian</option> | |
| <option value="Catalan (Valencia)">Catalan (Valencia)</option> | |
| <option value="Chinese (Traditional)">Chinese (Traditional)</option> | |
| <option value="Chinese (Simplified)">Chinese (Simplified)</option> | |
| <option value="Danish">Danish</option> |
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
| #!/usr/bin/env python | |
| bcd_digits = { | |
| "0": "0000", | |
| "1": "0001", | |
| "2": "0010", | |
| "3": "0011", | |
| "4": "0100", | |
| "5": "0101", | |
| "6": "0110", |