Skip to content

Instantly share code, notes, and snippets.

Avatar

Jasdev Singh jasdev

View GitHub Profile
@jasdev
jasdev / gallery.js
Last active Aug 29, 2015
Fetch top 5 Gallery Items from Imgur
View gallery.js
@jasdev
jasdev / clonerev.sh
Last active Aug 29, 2015
Clone repo at specific commit
View clonerev.sh
clonerev() {
git clone $1
cd 'sed ${1}##/*/ s/.git//'
git reset --hard $2
}
# Usage: clonerev [url] [commit hash]
View keybase.md

Keybase proof

I hereby claim:

  • I am jasdev on github.
  • I am jasdev (https://keybase.io/jasdev) on keybase.
  • I have a public key whose fingerprint is 711E 45E8 FF90 3997 AA07 6FD0 D107 2F37 4EB8 54D8

To claim this, I am signing this object:

@jasdev
jasdev / UpperCaseLetter.swift
Created Aug 12, 2015
Swift 2.0 gist to quickly determine if a String contains an uppercase alphabetical character
View UpperCaseLetter.swift
extension String {
func containsUpperCaseLetter() -> Bool {
let beginCodePoint = Character("A").unicodeScalarCodePoint()
let endCodePoint = Character("Z").unicodeScalarCodePoint()
for scalar in self.unicodeScalars {
if case beginCodePoint...endCodePoint = scalar.value {
return true
}
}
@jasdev
jasdev / BKLNSwiftPresenters.md
Last active Aug 29, 2015 — forked from marcdown/BKLNSwiftPresenters.md
Brooklyn Swift Developers Meetup Presenters
View BKLNSwiftPresenters.md
@jasdev
jasdev / AppDelegate.swift
Last active Sep 5, 2015
A Tour of UIUserNotificationAction
View AppDelegate.swift
import UIKit
enum Notifications {
enum Categories: String {
case Message
}
enum Actions: String {
case RemindMeLater
case Reply
@jasdev
jasdev / gist:3204954
Created Jul 30, 2012
Who uses Linked Lists anyways?
View gist:3204954
//Funny code segment I hacked together
private void TransportationPanel_Tap(object sender, System.Windows.Input.GestureEventArgs e)
{
settings["transportationMode"] = transportationOptions[(transportationOptions.IndexOf((string)settings["transportationMode"]) + 1) % 3];
switch ((string)settings["transportationMode"])
{
case "bike":
TransportationOption.Source = new BitmapImage(new Uri("Images/Icons/bike_icon_white.png", UriKind.Relative));
break;
case "car":
View gist:3205164
private void RadiusPanel_Tap(object sender, System.Windows.Input.GestureEventArgs e)
{
settings["radius"] = ((int)settings["radius"] % 10) + 1;
radiusText.Text = (int)settings["radius"] + ((int)settings["radius"] != 1 ? " miles" : " mile");
}
@jasdev
jasdev / gist:3210317
Created Jul 30, 2012
C# at it's finest
View gist:3210317
foreach (DAO daoFile in daoFiles)
{
StoredProcedure correspondingPoc = (from x in sProcs
where x.file == daoFile.calledProc select x).FirstOrDefault();
if (correspondingPoc != null)
{
IEnumerable<Error> except = correspondingPoc.possibleErrors.Except(daoFile.errorsCaught, new ErrorComparer());
}
}
@jasdev
jasdev / gist:3214252
Created Jul 31, 2012
Time representation fun
View gist:3214252
TimeSpan t = TimeSpan.FromSeconds(time);
f.dataString = distance + " mi" + "\n" + string.Format((t.Hours == 0 ? "" : "{0:D1}h:") + (t.Minutes > 9 ? "{1:D2}m" : "{1:D1}m"), t.Hours, t.Minutes);