Skip to content

Instantly share code, notes, and snippets.

var map = [
[0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0]
];
function checkAcross(arr, val, limit) {
var counter = 0;
for (var i = 0, l = arr.length; i < l; i++) {
counter = (arr[i] === val) ? ++counter : 0;
if (counter === limit) {
return true;
}
}
return false;
}
function animate(data) {
var animateTop = 1040;
var top = Math.round((1040 / 6) * data[0]);
var left = fixLeft(data[1]);
var move = setInterval(function(){
for (var i = 0; i < 2; i++) {
context.save();
animateTop = animateTop - 1;
context.clearRect(left, (animateTop + 1), 200, 200);
for (var row = 0; row < map_positions.length; row++) {
for (var column = 0; column < map_positions[row].length; column++) {
if (map_positions[row][column] !== 0) {
if (map_positions[row][column][2] == 1) {
if (map_positions[row][column][2] != winner_number) {
$('body').append('<div class="exploding blue-explode" style="top:' + map_positions[row][column][0] + '; left:' + map_positions[row][column][1] + ';"></div>');
} else {
$('body').append('<div class="exploding blue-noexplode" style="top:' + map_positions[row][column][0] + '; left:' + map_positions[row][column][1] + ';"></div>');
}
} else if (map_positions[row][column][2] == 2) {
$scopes = array('https://www.googleapis.com/auth/calendar', 'https://www.googleapis.com/auth/calendar.readonly');
$credentials = new Google_Auth_AssertionCredentials(
$client_email,
$scopes,
$private_key,
'notasecret'
);
$client = new Google_Client();
$client->setAssertionCredentials($credentials);
if ($client->getAuth()->isAccessTokenExpired()) {
if (!$stop && $attendee['displayName'] == $person) {
$start_time = strtotime($event->getStart()->getDateTime());
$end_time = strtotime($event->getEnd()->getDateTime());
//see if current time is in between an event
if (($start_time < $current_time) and ($current_time < $end_time)) { $start_time = date('g:i', $start_time); $end_time = date('g:i', $end_time); $event_id = $event->id;
$event = $service->events->get($calendar, $event_id);
$summary = $event->getSummary();
$message = $person . ' is in ' . $summary . ' from ' . $start_time . ' until ' . $end_time;
}
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
//hide statusbar
if (Build.VERSION.SDK_INT < 16) {
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
setContentView(R.layout.activity_main);
} else {
<table cellpadding="0" cellspacing="0" border="0" height="100" width="100%">
<tr>
<td background="https://www.toptal.com/designers/subtlepatterns/patterns/pink%20dust.png" bgcolor="#3d3b3c" valign="top">
<!--[if gte mso 9]>
<v:rect xmlns:v="urn:schemas-microsoft-com:vml" fill="true" stroke="false" style="mso-width-percent:1000;height:400px;">
<v:fill type="tile" src="https://www.toptal.com/designers/subtlepatterns/patterns/pink%20dust.png" color="#3d3b3c" />
<v:textbox inset="0,0,0,0">
<![endif]-->
<div>
<p style="line-height:100px;text-align:center;color:#ffffff;">Background Image</p>
<img src="https://www.toptal.com/designers/subtlepatterns/patterns/pink%20dust.png" width="100" height="100">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no, viewport-fit=cover">