Skip to content

Instantly share code, notes, and snippets.

Avatar

Jon Friskics jonfriskics

View GitHub Profile
@jonfriskics
jonfriskics / .gitattributes
Created Sep 25, 2019
.gitattributes file to add to Project repos
View .gitattributes
# From https://help.github.com/en/articles/configuring-git-to-handle-line-endings
# Set the default behavior, in case people don't have core.autocrlf set.
* text=auto
# Explicitly declare text files you want to always be normalized and converted
# to native line endings on checkout.
*.c text
*.h text
# Declare files that will always have CRLF line endings on checkout.
@jonfriskics
jonfriskics / example-mocha-test.js
Last active Sep 9, 2019
Example Mocha.js Test
View example-mocha-test.js
describe("QuizQuestion.js", () => {
it("should have a method named handleClick with the correct parameter @quiz-question-should-have-handle-click", () => {
assert("CONDITION CHECKING IF HANDLECLICK EXISTS", "`QuizQuestion.js` does not contain a method named `handleClick`")
assert("CONDITION CHECKING HANDLECLICK PARAMETER", "`QuizQuestion.js does not have the method named `handleClick` with a parameter named `buttonText`")
})
})
@jonfriskics
jonfriskics / gist:254da17c69b5a9816c60
Created Sep 23, 2015
Turn off dotted page break line in Google Docs w/Stylish
View gist:254da17c69b5a9816c60
.kix-page-compact::before {
border-top: 0 !important;
}
View gist:10b87838fb49944ec62d
Here's the code I'm using with some logs below.
- (void)viewWillAppear:(BOOL)animated
{
self.manager = [[CMMotionManager alloc] init];
self.manager.deviceMotionUpdateInterval = 0.2;
self.manager.accelerometerUpdateInterval = 0.2;
self.manager.gyroUpdateInterval = 0.2;
self.manager.magnetometerUpdateInterval = 0.2;
[self.manager startDeviceMotionUpdatesToQueue:[NSOperationQueue mainQueue] withHandler:^(CMDeviceMotion *motion, NSError *error) {
@jonfriskics
jonfriskics / ComicViewController.swift
Last active Aug 29, 2015
Weird initializer behavior
View ComicViewController.swift
import UIKit
class ComicViewController: UIViewController, UIScrollViewDelegate {
var comicToLoad:NSDictionary
/* This is a custom initializer, but it has to call init(nibName, bundle) or there's a compiler error.
I get that, because init(nibName, bundle) is the designated initializer, but ... */
init(passedInComic: NSDictionary) {
comicToLoad = passedInComic
@jonfriskics
jonfriskics / AppDelegate.swift
Created Sep 29, 2014
Is there something special that I have to do when unwrapping objects and getting access to the structs inside of them? This currently works with forced unwrapping, but not with optional binding/chaining. Check out lines 74 through 78 in ViewController.swift
View AppDelegate.swift
//
// AppDelegate.swift
// Test
//
// Created by Jon Friskics on 9/29/14.
// Copyright (c) 2014 Code School. All rights reserved.
//
import UIKit
@jonfriskics
jonfriskics / functions.playground
Last active Aug 29, 2015
Function Argument Unwrap Optional
View functions.playground
func myFunc1(name: String!) {
println(name); // playground shows "Jon1" is printed
}
func myFunc2(name: String) {
println(name); // playground shows "Jon2" is printed
}
let str1:String? = "Jon1"; // playground shows str1 is {Some "Jon1"}
let str2:String = "Jon2"; // playground shows str2 is "Jon2"
View TableViewController.m
#import "CSTableViewController.h"
@interface CSTableViewController ()
@end
@implementation CSTableViewController
- (id)initWithStyle:(UITableViewStyle)style
{
View gist:4706b45a712c0634815b
// add these for https://github.com and http://github.com with Stylish (https://chrome.google.com/webstore/detail/stylish/fjnbnpbmkenffdnngjfgmeleoegfcffe?hl=en)
// fixes the sidebar repo list truncation on the /dashboard page
.css-truncate-target {
overflow: hidden !important;
white-space: normal !important;
display: block;
max-width: 500px !important;
}
@jonfriskics
jonfriskics / fb-messenger-ios-permissions.md
Last active Nov 23, 2015
Facebook Messenger Permissions and iOS
View fb-messenger-ios-permissions.md

This document is an attempt to debunk all of those "Facebook Messenger is evil!" messages that are cluttering up my news feed. There's several versions of it, but this document is using this one for separating each claim: http://threepercenternation.com/2014/08/facebook-crosses-the-line-with-messenger-app/

Please let me know if I missed something or got something wrong - and if you're interested in working on an Android/Windows Phone version of this then that would be swell too!

Phone Calls and SMS Messages

Call phone numbers and send SMS messages – This means that if Facebook wants to…it can send text messages to your contacts on your behalf.

Developers can create a link that contains a phone number (tel:// URL Scheme), but the user will always be prompted with a "Call" action button - no phone call can automatically be triggered.