Skip to content

Instantly share code, notes, and snippets.

@seabaylea
seabaylea / BuildWithNSURLSession.md
Created Jun 11, 2016
How to build a Swift toolchain on Linux with full Dispatch and NSURLSession support
View BuildWithNSURLSession.md

Follow the instructions to checkout a full Swift build for Linux:

git clone https://github.com/apple/swift.git
cd swift
./utils/update-checkout --clone

Update the libdispatch component to use the 'experimental/foundation' branch:

cd swift-corelibs-libdispatch
@beaucharman
beaucharman / debounce.js
Last active Aug 29, 2021
An ES6 implementation of the debounce function. "Debouncing enforces that a function not be called again until a certain amount of time has passed without it being called. As in 'execute this function only if 100 milliseconds have passed without it being called.'" - CSS-Tricks (https://css-tricks.com/the-difference-between-throttling-and-debounc…
View debounce.js
function debounce(callback, wait, immediate = false) {
let timeout = null
return function() {
const callNow = immediate && !timeout
const next = () => callback.apply(this, arguments)
clearTimeout(timeout)
timeout = setTimeout(next, wait)
@lukewhitehouse
lukewhitehouse / README.md
Last active Sep 10, 2015
Check for if an element is in view
View README.md

Check for if an element is in view

This script allows you to tell when an element becomes visible in the browser window. You can use this to apply styling/animations to elements.

Instructions

Add this to your javascript. Make sure jQuery is called before this script.

Requirements

  • jQuery
@stuartjmoore
stuartjmoore / WPTextAttachment.h
Last active Oct 21, 2016
Creates an NSTextAttachment the takes up the entire width of the line fragment (while maintaining its aspect ratio). Instead of a simple image, any UIView (that has a (CGFloat)heightThatFits method) will work.
View WPTextAttachment.h
//
// WPTextAttachment.h
// ReadArticle
//
// Created by Moore, Stuart on 12/27/13.
// Copyright (c) 2013 The Washington Post. All rights reserved.
//
#import <UIKit/UIKit.h>
@eytanschulman
eytanschulman / gist:8521776
Created Jan 20, 2014
How to make UIActivityViewController not lag
View gist:8521776
[[NSOperationQueue mainQueue] addOperationWithBlock:^{
[self presentViewController:activityVC animated:YES completion:^{
}];
}];
@shobotch
shobotch / key.md
Last active Jan 19, 2022
Twitter (un)official Consumer Key
View key.md

Twitter Official Consumer Key

Twitter for Android

type:            PIN
Consumer key:    3nVuSoBZnx6U4vzUxf5w
Consumer secret: Bcs59EFbbsdF6Sl9Ng71smgStWEGwXXKSjYvPVt7qys

Twitter for iPhone

type:            PIN
Consumer key:    IQKbtAYlXLripLGPWd0HUA
@coenjacobs
coenjacobs / wc-attribute-links.php
Created May 4, 2012
Display WooCommerce product attribute archive links on product page, right below the add to cart button.
View wc-attribute-links.php
@dhm116
dhm116 / ie.shims.js
Created Feb 10, 2012
IE7/8 Javascript method shims
View ie.shims.js
'use strict';
// Add ECMA262-5 method binding if not supported natively
//
if (!('bind' in Function.prototype)) {
Function.prototype.bind= function(owner) {
var that= this;
if (arguments.length<=1) {
return function() {
return that.apply(owner, arguments);