Skip to content

Instantly share code, notes, and snippets.

View joemidi's full-sized avatar

Joey Padasian joemidi

View GitHub Profile
function slugify(text)
{
return text.toString().toLowerCase()
.replace(/\s+/g, '-') // Replace spaces with -
.replace(/(\.png|\.jpg|\.jpeg)/, '') // Remove file exenstion
.replace(/[^\w\-]+/g, '') // Remove all non-word chars
.replace(/\-\-+/g, '-') // Replace multiple - with single -
.replace(/^-+/, '') // Trim - from start of text
.replace(/-+$/, ''); // Trim - from end of text
}
[
{
"origin": ["*"],
"responseHeader": ["Content-Type", "Access-Control-Allow-Origin"],
"method": ["GET", "HEAD", "DELETE"],
"maxAgeSeconds": 3600
}
]
@joemidi
joemidi / enabler.exits.js
Last active July 12, 2024 15:43
Enabler exits
var queryString = 'q=headphones';
banner.addEventListener('click', function () {
Enabler.exitQueryString('clickthrough', queryString);
});
// You can use the Enabler.exitQueryString() method to apply an query string to an exit URL.
// Note that the base URL will still come from within the Studio interface.
// Alternatively you can create the full URL yourself using Enabler.exitOverride()
@joemidi
joemidi / flatten.js
Created December 10, 2018 23:10
Gulp Script to flatten Bannertime files into a single directory.
'use strict';
var config = require('../config');
var gulp = require('gulp');
var flatten = require('gulp-flatten');
var del = require('del');
var fs = require('fs');
var path = require('path');
var dir = require('node-dir');
var replace = require('gulp-replace-path');
@joemidi
joemidi / osx-for-hackers.sh
Created April 25, 2018 20:01 — forked from brandonb927/osx-for-hackers.sh
OSX for Hackers: Yosemite/El Capitan Edition. This script tries not to be *too* opinionated and any major changes to your system require a prompt. You've been warned.
#!/bin/sh
###
# SOME COMMANDS WILL NOT WORK ON macOS (Sierra or newer)
# For Sierra or newer, see https://github.com/mathiasbynens/dotfiles/blob/master/.macos
###
# Alot of these configs have been taken from the various places
# on the web, most from here
# https://github.com/mathiasbynens/dotfiles/blob/5b3c8418ed42d93af2e647dc9d122f25cc034871/.osx
@joemidi
joemidi / unlock.applescript
Created January 18, 2016 11:48
Unlock all folders
on run {input, parameters}
set currentFolder to POSIX path of input
do shell script ("/bin/chmod -R 777 " & quoted form of currentFolder)
return input
end run
@joemidi
joemidi / copy-server-loc.applescript
Created January 18, 2016 11:47
Copy a server location
on run
tell application "Finder" to set sel to selection
open sel
end run
on SAR(main_text, search_text, replace_text)
-- Search and Replace. Search for search-text in
-- main_text and replace it by replace_text.
set old_delims to AppleScript's text item delimiters
try
@joemidi
joemidi / post-receive
Last active December 6, 2015 19:16
Post-Receive Git Hook to post a comment to an Asana task
#!/bin/bash
project_name="project-name"
# Generate your personal access token from your profile settings — apps.
# See: https://asana.com/guide/help/api/api
personal_access_token=""
task_id=""
print_comment="New preview available at: https://example.com/${project_name}"
while read oldrev newrev ref
do
@joemidi
joemidi / create-proj.sh
Last active December 6, 2015 19:17
Creates a project-directory on a server that is git ready with a pre-installed hook
#!/bin/bash
echo -n "Enter the project name > "
read project_name
echo -n "Enter the task ID > "
read task_id
DIRECTORY=/var/www/html/${project_name}
if [ ! -d "$DIRECTORY" ]; then
mkdir -p /var/www/html/${project_name}/git && cd $_ && git init --bare
touch hooks/post-receive
echo -e "#!/bin/bash
@joemidi
joemidi / gsap-spritesheet.plugin.jsfl
Last active August 29, 2015 14:20
GSAP - Flash Animated Spritesheet Generator
/* Author: Joey Padasian 2015
* An export option for Flash; a spritesheet animation using GSAP as the animation engine.
*/
function getPluginInfo(lang)
{
pluginInfo = new Object();
pluginInfo.id = "GSAP - Spritesheet";
pluginInfo.name = "GSAP - Spritesheet";
pluginInfo.ext = "html";