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
| pv_by_industry = GROUP profile_view by viewee_industry_id | |
| pv_avg_by_industry = FOREACH pv_by_industry | |
| GENERATE group as viewee_industry_id, AVG(profie_view) AS average_pv; |
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
| // Use built in or binary modules | |
| var crypto = require('crypto'); | |
| var hash = crypto.createHmac("sha1",key).update(signatureBase).digest("base64"); |
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
| public interface NameFormatter | |
| { | |
| enum Style | |
| { | |
| FAMILIAR_NAME, | |
| FULL_NAME, | |
| LIST_NAME | |
| }; | |
| public String format(String firstName, String lastName, String maidenName, Style style); |
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 app = express.createServer(); | |
| app.get('/', function(req, res){ | |
| res.send('Hello World'); | |
| }); | |
| app.listen(3000); |
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 _uid,_score,color | |
| FROM members | |
| WHERE color="red" AND | |
| category IN ("van","exotic") AND | |
| MATCH(contents) | |
| AGAINST("cool leather seats") | |
| GROUP BY color TOP 3 | |
| BROWSE BY color,category | |
| ORDER BY RELEVANCE | |
| LIMIT 0,10 |
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 java.util.Random; | |
| import java.util.Scanner; | |
| public class GuessNumber { | |
| public static void main(String[] args) { | |
| Random generator = new Random(); | |
| int toGuess = generator.nextInt(10) + 1; | |
| int guess; | |
| Scanner scanner = new Scanner(System.in); | |
| try { |
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 java.io.BufferedReader; | |
| import java.io.File; | |
| import java.io.FileReader; | |
| import java.io.IOException; | |
| import java.util.regex.Pattern; | |
| import java.util.regex.Matcher; | |
| /** | |
| * Usage: java Grep <regular_expression> <file_name> | |
| */ |
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
| class LinkedInProfile | |
| SIMPLE_PROFILE_FIELDS = %w[id summary headline honors interests specialties industry first_name last_name public_profile_url picture_url associations] | |
| SIMPLE_PROFILE_FIELDS.each do |field| | |
| define_method(field.to_sym) do | |
| @json[field] | |
| end | |
| end | |
| def initialize(json) |
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
| TestObject := Object clone do( | |
| foo := method("you called foo" println) | |
| bar := method("you called bar" println) | |
| baz := method("you called baz" println) | |
| ) | |
| TestObject getSlot(System args at(1)) call | |
| /* | |
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
| Complex := Object clone do ( | |
| setValues := method(real, imaginary, | |
| self real := real; | |
| self imaginary := imaginary; | |
| self | |
| ) | |
| + := method(other, | |
| result := Complex clone setValues(self real + other real, self imaginary + other imaginary) | |
| ) | |
| ) |