Skip to content

Instantly share code, notes, and snippets.

# Script for building and exporting iOS project
workspace_name=xxxx
scheme_name=xxxx
current_dir=$(dirname $0)
root_dir=$current_dir/..
archive_path=$root_dir/build/ios/archive/$workspace_name.xcarchive
export_path=$root_dir/build/ios/export
echo "Recreating build folder"
@chris-muller
chris-muller / example.js
Last active September 17, 2019 04:31
Easy way to keep track of the $1, $2, $3, etc count inside an SQL query when working with loops, etc
import Bind from './sql-bind-incrementor.js'
const bind = new Bind()
const limit = 10
const queryValues = ['id_value', 'order_id_value']
const item_ids = ['aaa', 'bbb', 'ccc']
let sql = `
@chris-muller
chris-muller / entries_view.sql
Created September 26, 2018 00:12
SQL View that has a conditional column, simplifying other complex queries
CREATE VIEW "view_entries" AS
-- Approved Entries
SELECT
"entries"."id",
"entries"."awardId",
"entries"."categoryId",
"entries"."userId",
CASE
@chris-muller
chris-muller / git-cheatsheet
Created September 2, 2018 23:41
Basic git commands
# Merge changes from one branch to another
git checkout master
git merge origin/hotfix
# Reset local to match the server
git fetch --all
@chris-muller
chris-muller / create.js
Created November 27, 2017 22:35
Sequelize Insert With Association
// Example of how to insert a record that includes a new association to be created with it
// assumes that sequelize and the associations have already been configured earlier.
var data = {
title: "Post title",
description: "Post description",
categories: [{
title: "General",
description: "The default category."
}]
@chris-muller
chris-muller / compareObjects
Created July 28, 2017 05:27
Compare two objects
function compare(newField, oldField) {
var isClean = true;
for (var property in newField) {
if (!newField.hasOwnProperty(property)) { continue; }
if(property == 'options') {
const newOptions = newField.options;
const oldOptions = oldField.options;
@chris-muller
chris-muller / cookies.js
Last active May 2, 2017 23:24
Simple script to set cookies and check if cookie is still present.
var cookie = function () {
function setCookie(name, value, expiry) {
name = (typeof name !== 'undefined') ? name : "cookieName";
value = (typeof value !== 'undefined') ? value : "true";
expiry = (typeof expiry !== 'undefined') ? expiry : 1;
var date = new Date();
date.setTime(date.getTime() + (expiry * 1000 * 60 * 60 * 24));
var expires = "expires=" + date.toUTCString();
// Nice way of getting the conciseness
// benefits of using an enum when using
// non-literal values
enum Size {
case Large
case Medium
case Small
var value: CGSize {
switch self {
@chris-muller
chris-muller / README.md
Last active March 29, 2016 00:18
Example code for a 'related links' include.

#Usage Use the below code to include a post from your posts with a title of "Hello World!" You can change the collection that the include uses instead of using posts.

{% include related.html item="Hello World!" collection=site.posts %}

Could also be changed to match a custom variable instead of title if name collisions are a concern.

@chris-muller
chris-muller / headings-placeholder.scss
Last active February 26, 2016 08:46
Heading tags placeholder examples in Sass
// This applies all the rules
// targeting the headings
// placeholder class
h1, h2, h3,
h4, h5, h6 {
@extend %headings !optional;
}
// Example use of headings