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 google = require('googleapis'); | |
| var OAuth2 = google.auth.OAuth2; | |
| // constants | |
| var CLIENT_ID = '312634809793-4d4baf8u62ck2l4s7uucamp175m9q49p.apps.googleusercontent.com'; | |
| var CLIENT_SECRET = 'My Client Secret'; | |
| var REDIRECT_URL = 'http://localhost:3000/oauth2callback'; // registered with the developer console | |
| var oauth2Client = new OAuth2(CLIENT_ID, CLIENT_SECRET, REDIRECT_URL); |
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
| $('#submit').click(function(e) { | |
| // e.preventDefault(); | |
| console.log('clicked submit'); | |
| var $errors = $('#errors'), | |
| $status = $('#status'), | |
| name = $('#name').val().replace(/<|>/g, ""), // no xss | |
| email = $('#email').val().replace(/<|>/g, ""), | |
| msg = $('#message').val().replace(/<|>/g, ""); |
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 void onCreate(...) { | |
| ... | |
| SwipeDismissListViewTouchListener.DismissCallbacks dismissCallbacks = new SwipeDismissListViewTouchListener.DismissCallbacks() { | |
| @Override | |
| public boolean canDismiss(int position) { | |
| return true; | |
| } | |
| @Override | |
| public void onDismiss(ListView listView, int[] reverseSortedPositions) { |
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
| btn.setOnClickListener(new OnClickListener() { | |
| public void onClick(View 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
| public static void main(string[] args) | |
| { | |
| // let's say there are 10 boys, 11 girls and each girl gets to choose 5 | |
| const int BOY_AMOUNT = 10; | |
| const int GIRL_AMOUNT = 11; | |
| const int CHOICE_AMOUNT = 5; | |
| // indexes are serial numbers and the values are their scores | |
| int[] boys = new int[BOY_AMOUNT]; |
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.awt.Point; | |
| public class Main { | |
| public static void printMatrix(int[][] mat) { | |
| for (int i = 0; i < mat.length; i++) | |
| { | |
| for (int j = 0; j < mat.length; j++) | |
| System.out.print(mat[i][j] + " "); | |
| System.out.print("\n"); | |
| } |
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
| Node<Integer> lastNode = new Node<Integer>(rndVal, null); | |
| Node<Integer> nextNode = new Node<Integer>(rndVal - 1, lastNode); | |
| for (int i = rndVal - 2; i >= 0; i--) | |
| nextNode = new Node<Integer>(i, nextNode); |
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
| Node<Integer> lastNode = new Node<Integer>(rndVal, null); | |
| Node<Integer> nextNode = new Node<Integer>(rndVal - 1, lastNode); | |
| for (int i = rndVal - 2; i >= 0; i--) | |
| nextNode = new Node<Integer>(i, nextNode); | |
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
| int[] amount = new int[12]; // amount of rain at every month | |
| int yearSum = 0, halfSum1 = 0, halfSum2 = 0, overTheAverage = 0; | |
| double yearAvg, halfAvg1, halfAvg2; | |
| for (int i = 0; i < amount.Length; i++) | |
| { | |
| Console.WriteLine("enter the amount of rain for " + (i + 1) + "th month:"); | |
| amount[i] = int.Parse(Console.ReadLine()); | |
| yearSum += amount[i]; |