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
Animating a section to full screen in with jquery: | |
A few notes: | |
- This was made in 5 minutes; it can be a little sloppy. | |
- You need to import JQuery in your page. | |
- It'll probably work with non bootstrap sites too, I haven't had time to test it. | |
- You need to bind the goFullScreen() function to some kind of action. | |
- This Gist is far from finished. Things I hope to add in the future include: | |
- Leave full screen | |
- Instead of moving the navbar, or some other element up. Diynamically select everything prior to the current sectino |
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
$("form :input").each(function(index, elem) { | |
var eId = $(elem).attr("id"); | |
var label = null; | |
if (eId && (label = $(elem).parents("form").find("label[for="+eId+"]")).length == 1) { | |
$(elem).attr("placeholder", $(label).html()); | |
$(label).remove(); | |
} | |
}); |
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
git filter-branch --prune-empty --index-filter 'git rm -rf --cached --ignore-unmatch MY-BIG-DIRECTORY-OR-FILE' --tag-name-filter cat -- --all |
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
for family in UIFont.familyNames() { | |
println(family); | |
var family: String = family as String | |
for name in UIFont.fontNamesForFamilyName(family) { | |
println(" \(name)"); | |
} | |
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 convertToSeconds = function(time) { | |
if(!isNaN(time)){ | |
return time | |
} | |
var timeArray = time.split(':'), | |
seconds = 0, minutes = 1; | |
while (timeArray.length > 0) { |
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
// order an array | |
// to use: <div ng-repeat="thing in things | orderTimeObjectBy:'order'"> | |
app.filter('orderObjectBy', function() { | |
return function(items, field, reverse) { | |
var filtered = []; | |
angular.forEach(items, function(item) { | |
filtered.push(item); | |
}); | |
filtered.sort(function (a, b) { | |
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
class TextView: UITextView { | |
override init(frame: CGRect) { | |
super.init(frame: frame) | |
addContentSizeObserver() | |
} | |
override init(frame: CGRect, textContainer: NSTextContainer?) { | |
super.init(frame: frame, textContainer: textContainer) | |
} |
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
// Verification code is at least for digit long | |
let verificationCode = String(1000+arc4random_uniform(8999)) |
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
// movieService can be used in a controller like this: | |
// movieService.getMovieDetails("Pulp Fiction").success(function (data) { | |
// $scope.movie = data | |
// } | |
app.factory('movieService', ['$http', function ($http) { | |
return { | |
getMovieDetails: function (title) { | |
var getData = { | |
method: 'jsonp', | |
url: 'http://www.omdbapi.com/?t=' + title, //add +'&apikey=YOUR_API_KEY' if you have one. |
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
// | |
// DistanceHelper.Swift | |
// Wildcard | |
// | |
// Created by Samuel Beek on 01-05-15. | |
// Copyright (c) 2015 Wildcard. All rights reserved. | |
// | |
import Foundation |
OlderNewer