Skip to content

Instantly share code, notes, and snippets.

View cameck's full-sized avatar
🍩
(ॢ◕ัڡ ◕ั ॢ)

Cameron Eckelberry cameck

🍩
(ॢ◕ัڡ ◕ั ॢ)
View GitHub Profile
@stinoga
stinoga / console.js
Created December 27, 2014 22:18
Save console output to a file
(function(console){
console.save = function(data, filename){
if(!data) {
console.error('Console.save: No data')
return;
}
if(!filename) filename = 'console.json'
@eddroid
eddroid / 1.never_boolean.md
Last active April 6, 2016 20:43
Ruby Refactorings

Never Boolean

You hardly ever have to use the word true in your code.

if (something == true)
  # do something cool
end

Can be rewritten as

@mackuba
mackuba / content_blocker_tips.md
Last active April 19, 2023 13:51
Tips for writing iOS content blockers - HelsinkiOS
  • read this first: https://www.webkit.org/blog/3476/content-blockers-first-look/
  • start by adding a new extension target to your iOS app of type “content blocker”
  • launch the app using the main target’s scheme + a call to SFContentBlockerManager.reloadContentBlockerWithIdentifier() with the extension’s id in application:didFinishLaunchingWithOptions: to auto-reload the blocker in development mode
  • if you don’t call reloadContentBlockerWithIdentifier() then you need to switch the blocker off and on again in the Safari settings (stop the app in Xcode if the switch is not moving)
  • use inspector from desktop Safari to inspect the Safari in the simulator in order to find specific things to block
  • things like periods in the url-filter regexp need to be escaped with double backslashes, e.g. facebook\\.net
  • if you use if-domain, it needs to be an array, even for one element
  • domain foo.com might not match www.foo.com even though I think it’s supposed to (UPDATE: They've changed it in one of
@maciekish
maciekish / resetXcode.sh
Created August 10, 2016 10:13
Reset Xcode. Clean, clear module cache, Derived Data and Xcode Caches. You can thank me later.
#!/bin/bash
killall Xcode
xcrun -k
xcodebuild -alltargets clean
rm -rf "$(getconf DARWIN_USER_CACHE_DIR)/org.llvm.clang/ModuleCache"
rm -rf "$(getconf DARWIN_USER_CACHE_DIR)/org.llvm.clang.$(whoami)/ModuleCache"
rm -rf ~/Library/Developer/Xcode/DerivedData/*
rm -rf ~/Library/Caches/com.apple.dt.Xcode/*
open /Applications/Xcode.app
@andywirv
andywirv / gist:f312d561c9702522f6d4ede1fe2750bd
Created November 22, 2016 19:58
Update Lambda function configuration, specifically the environment variables. AWS Cli version aws-cli/1.11.20
#quotes on json, single around entire object and double on each property
aws lambda update-function-configuration --function-name=[lambda function name] --environment '{"Variables":{"abc":"124"}}'
@thejohnfreeman
thejohnfreeman / instructions.md
Last active January 5, 2023 02:15
Semantic UI fonts with Webpack in a Chrome extension

To get Semantic UI fonts working:

  1. npm install semantic-ui-css

  2. Import 'semantic-ui-css/semantic.css' in your entry script. The exact syntax for this varies depending on your chosen module format: import for ES6, require for CommonJS, etc. This tells Webpack to pull the CSS into your bundle.

  3. npm install --save-dev style-loader css-loader

@joshbuchea
joshbuchea / semantic-commit-messages.md
Last active April 16, 2024 12:32
Semantic Commit Messages

Semantic Commit Messages

See how a minor change to your commit message style can make you a better programmer.

Format: <type>(<scope>): <subject>

<scope> is optional

Example

@cjkoepke
cjkoepke / logging_errors.js
Created August 10, 2017 18:20
Debugging tips and tricks.
// Great for getting values, outputting context strings, and so on.
console.log(variable)
// Same as console.log(), but prints in yellow as a warning. Useful to show a non-breaking error in a dev env.
console.warn('It is a good idea to use .map instead of a for-loop.')
// Same as console.log(), but prints in red as an error. Useful to show a breaking error in a dev env.
console.error(`The value must be an integer. You provided a ${typeof variable}.`)
// Group console data together for better viewing. Nice to group console logs together.
function injectGitFileStatus()
{
const timeout = 5000;
const addedColor = "#8dc149";
const modifiedColor = "#cbcb41";
const stagedColor = "#ca2820";
const ignoredOpacity = "0.4";
const explorer = document.getElementById("workbench.view.explorer");
if (explorer)
//
// TextStyle.swift
//
// Created by Rob Napier on 12/20/19.
// Copyright © 2019 Rob Napier. All rights reserved.
//
import SwiftUI
public struct TextStyle {