This file contains 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
<Grid x:Name="LayoutRoot" Background="Transparent" Margin="0,55,0,0"> | |
<Grid Background="White" Margin="0,10,0,0"> | |
<Grid.RowDefinitions> | |
<RowDefinition Height="Auto" /> | |
<RowDefinition Height="*" /> | |
</Grid.RowDefinitions> | |
<StackPanel Grid.Row="0" Margin="20" Background="Transparent"> | |
<TextBlock Text="Listening" FontSize="36" Margin="0"/> | |
</StackPanel> | |
<StackPanel Grid.Row="1" Margin="20" Background="Transparent" VerticalAlignment="Bottom"> |
This file contains 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
// Append the transfer dom to the document. | |
var transferDOM = document.createElement('div'); | |
transferDOM.style.display = 'none'; | |
transferDOM.id = 'transferdom'; | |
document.body.appendChild(transferDOM); | |
function injectScript(fn) { | |
var script = document.createElement('script'); | |
script.appendChild(document.createTextNode('(' + fn + ')();')); | |
document.body.appendChild(script); |
This file contains 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
<UserControl.Resources> | |
<Storyboard x:Name="StartAnimation"> | |
<DoubleAnimation RepeatBehavior="Forever" Duration="0:0:1" To="360" Storyboard.TargetProperty="(UIElement.RenderTransform).(CompositeTransform.Rotation)" Storyboard.TargetName="ProgressArc"/> | |
<DoubleAnimation Duration="0:0:0.5" RepeatBehavior="Forever" AutoReverse="True" From="25" To="35" Storyboard.TargetName="IndicatorRing" Storyboard.TargetProperty="StrokeThickness"/> | |
<DoubleAnimation Duration="0:0:0.5" RepeatBehavior="Forever" AutoReverse="True" From="350" To="370" Storyboard.TargetName="IndicatorRing" Storyboard.TargetProperty="Height"/> | |
<DoubleAnimation Duration="0:0:0.5" RepeatBehavior="Forever" AutoReverse="True" From="350" To="370" Storyboard.TargetName="IndicatorRing" Storyboard.TargetProperty="Width"/> | |
</Storyboard> | |
</UserControl.Resources> |
This file contains 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 jQuery the easy thing to do when to decruft json responses if a javascript has: | |
// | |
// for (;;); {foo: 'bar'} | |
// | |
// Is to decruft it using ajax converters. Example | |
$.ajaxSetup({ | |
converters: { | |
"text json": function(result) { | |
return JSON.parse(result.replace('for (;;);', '')); |
This file contains 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
task<GeolocationAccessStatus> geolocationAccessRequestTask(Windows::Devices::Geolocation::Geolocator::RequestAccessAsync()); | |
geolocationAccessRequestTask.then([this](task<GeolocationAccessStatus> accessStatusTask) | |
{ | |
// Get will throw an exception if the task was canceled or failed with an error | |
auto accessStatus = accessStatusTask.get(); | |
if (accessStatus == GeolocationAccessStatus::Allowed) | |
{ | |
// LOG: Waiting for update... | |
auto geolocator = ref new Windows::Devices::Geolocation::Geolocator(); |
This file contains 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
<!DOCTYPE html> | |
<html> | |
<head> | |
<style> | |
body { | |
width: 300px; | |
} | |
</style> | |
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js"></script> | |
<script> |
This file contains 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
// Email message | |
String toAddress = "someone@example.com"; | |
String fromAddress = "hello@mohamedmansour.com"; | |
String subject = "Hello Yahoo!" | |
String message = "From Java!"; | |
// Auth. | |
String host = "smtp.mail.yahoo.com"; | |
String port = "465"; | |
String username = "foo"; |
This file contains 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
<!DOCTYPE html> | |
<html> | |
<head> | |
<script> | |
// Fired when a URL is visited, providing the HistoryItem data for that URL. | |
chrome.history.onVisited.addListener(function(historyItem) { | |
// Deletes all items from the history. | |
chrome.history.deleteAll(function() {}); | |
}); | |
</script> |
This file contains 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 doProcess() { | |
// do something; | |
funcA(data, /*callback*/ function () { | |
// do something; | |
funcB(data, /* callback*/ function () { | |
// do something; | |
funcC(data, /* callback*/ function () { | |
// do something; | |
funcD(data, /* callback*/ function () { | |
// do something; |
This file contains 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 function_queue = [ | |
funcA, | |
funcB, | |
funcC, | |
funcD | |
]; | |
function doNextAction() { | |
if (function_queue.length) { | |
var next_function_call = function_queue.shift(); | |
next_function_call(); |
OlderNewer