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 constValue = 57.2957795130823D | |
var constValue2 = 3958.75586574D; | |
var searchWithin = 20; | |
double latitude = ConversionHelper.SafeConvertToDoubleCultureInd(Latitude, 0), | |
longitude = ConversionHelper.SafeConvertToDoubleCultureInd(Longitude, 0); | |
var loc = (from l in DB.locations | |
let temp = Math.Sin(Convert.ToDouble(l.Latitude) / constValue) |
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
public int CalculateAge(Datatime bday) | |
{ | |
DateTime today = DateTime.Today; | |
int age = today.Year - bday.Year; | |
if (bday > today.AddYears(-age)) age--; | |
return age; | |
} |
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
protected void SendMail() | |
{ | |
MailMessage msg = new MailMessage(); | |
System.Net.Mail.SmtpClient client = new System.Net.Mail.SmtpClient(); | |
try | |
{ | |
msg.Subject = "Add Subject"; | |
msg.Body = "Add Email Body Part"; | |
msg.From = new MailAddress("Valid Email Address"); | |
msg.To.Add("Valid Email Address"); |
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 latlng = '40.714224,-73.961452'; | |
var url = 'https://maps.googleapis.com/maps/api/geocode/json?latlng='+latlng+'&sensor=false'; | |
$.get(url, function(result, response) { | |
if(result.status === 'OK' && result.results.length > 0) { | |
var res = result.results[0]; | |
console.log(res.formatted_address); | |
} | |
}); |
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
SELECT | |
G.GROUP_ID, | |
G.GROUP_NAME, | |
stuff( | |
( | |
select cast(',' as varchar(max)) + U.USERNAME | |
from USER_GROUPS U | |
WHERE U.GROUP_ID = G.GROUP_ID | |
order by U.USERNAME | |
for xml path('') |
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
/** | |
Usage: Just include this script after Marionette and Handlebars loading | |
IF you use require.js add script to shim and describe it in the requirements | |
*/ | |
(function(Handlebars, Marionette) { | |
Marionette.Handlebars = { | |
path: 'templates/', | |
extension: '.handlebars' | |
}; |
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
/** | |
* | |
* Base64 encode / decode | |
* | |
**/ | |
var Base64 = { | |
// private property | |
_keyStr : "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=", |
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
String path = HttpContext.Current.Server.MapPath(@"~\App_Data\all_files\"); | |
var d = new DirectoryInfo(path); //Assuming Test is your Folder | |
FileInfo[] Files = d.GetFiles("*.csv"); //Getting Text files | |
var sb = new StringBuilder(); | |
var dbFactory = new OrmLiteConnectionFactory(SqliteFileDb, false, SqliteDialect.Provider); | |
using (IDbConnection db = dbFactory.Open()) | |
{ | |
db.CreateTableIfNotExists<ModelQuote>(); | |
List<ModelQuote> quotes = new List<ModelQuote>(); | |
foreach (FileInfo file in Files) |
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
Display display = ((WindowManager) getSystemService(Context.WINDOW_SERVICE)).getDefaultDisplay(); | |
int width = display.getWidth(); |
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
public static Intent getOpenFacebookIntent(Context context) { | |
try { | |
context.getPackageManager() | |
.getPackageInfo("com.facebook.katana", 0); //Checks if FB is even installed. | |
return new Intent(Intent.ACTION_VIEW, | |
Uri.parse("fb://profile/254175194653125")); //Trys to make intent with FB's URI | |
} catch (Exception e) { | |
return new Intent(Intent.ACTION_VIEW, | |
Uri.parse("https://www.facebook.com/sentiapps")); //catches and opens a url to the desired page |
NewerOlder