Skip to content

Instantly share code, notes, and snippets.

@ttrahan
ttrahan / block_personal_appts
Last active April 10, 2024 13:47
Google Apps Script to automatically create, edit and delete events on work calendar for personal calendar events. Instructions on how to set up can be found at https://medium.com/@willroman/auto-block-time-on-your-work-google-calendar-for-your-personal-events-2a752ae91dab
function sync() {
var id="XXXXXXXXXX"; // CHANGE - id of the secondary calendar to pull events from
var today=new Date();
var enddate=new Date();
enddate.setDate(today.getDate()+7); // how many days in advance to monitor and block off time
var secondaryCal=CalendarApp.getCalendarById(id);
var secondaryEvents=secondaryCal.getEvents(today,enddate);
@alexkrolick
alexkrolick / webpack.config.js
Last active July 13, 2017 04:11
Webpack Config for Webpack-Rails + CDN for production (Webpack 1.x - some minor differences may be encountered for Webpack 2+)
const CDN = process.env['CDN_HOST'] || '';
/**
* Webpack configuration for integrating Webpack with Rails via the webpack-rails gem
* (https://github.com/mipearson/webpack-rails)
*
* Cache-Busting Strategy:
* Development: Change query string of resource when content MD5 hash changes,
* rewriting the asset in place but triggering rewrite of the manifest.
* Production: Use MD5 hash of asset as filename, writing new assets and manifest
@bmhatfield
bmhatfield / .profile
Last active May 6, 2024 22:27
Automatic Git commit signing with GPG on OSX
# In order for gpg to find gpg-agent, gpg-agent must be running, and there must be an env
# variable pointing GPG to the gpg-agent socket. This little script, which must be sourced
# in your shell's init script (ie, .bash_profile, .zshrc, whatever), will either start
# gpg-agent or set up the GPG_AGENT_INFO variable if it's already running.
# Add the following to your shell init to set up gpg-agent automatically for every shell
if [ -f ~/.gnupg/.gpg-agent-info ] && [ -n "$(pgrep gpg-agent)" ]; then
source ~/.gnupg/.gpg-agent-info
export GPG_AGENT_INFO
else
@thebugs
thebugs / rules-delimiter.js
Last active July 22, 2016 22:42
rules-delimiter option for csscomb.js
module.exports = {
name: 'rules-delimiter',
syntax: ['scss'],
runBefore: "strip-spaces",
setValue: function(value) {
if (typeof value === 'number') {
value = Array(value + 2).join('\n');
@youngbrioche
youngbrioche / images_helper.rb
Last active February 8, 2024 08:15
Responsive images helper using srcset in Rails
module ImagesHelper
# Acts as a thin wrapper for image_tag and generates an srcset attribute for regular image tags
# for usage with responsive images polyfills like picturefill.js, supports asset pipeline path helpers.
#
# image_set_tag 'pic_1980.jpg', { 'pic_640.jpg' => '640w', 'pic_1024.jpg' => '1024w', 'pic_1980.jpg' => '1980w' }, sizes: '100vw', class: 'my-image'
#
# => <img src="/assets/ants_1980.jpg" srcset="/assets/pic_640.jpg 640w, /assets/pic_1024.jpg 1024w, /assets/pic_1980.jpg 1980w" sizes="100vw" class="my-image">
#
def image_set_tag(source, srcset = {}, options = {})
srcset = srcset.map { |src, size| "#{path_to_image(src)} #{size}" }.join(', ')
@Jesus
Jesus / config_files.rb
Last active February 21, 2021 10:44
Config. file uploader task for Capistrano 3
# lib/capistrano/tasks/config_files.cap
#
# Capistrano task to upload configuration files outside SCM
# Jesus Burgos Macia
#
# This allows us to have server's config files isolated from development ones.
# That's useful for several reasons, but the most important is that you can
# ignore files from repository.
#
# The task will upload all files found in
@jakob-e
jakob-e / ResponsiveFonts.scss
Created September 22, 2013 09:42
ResponsiveFonts
// SCSS Mixin v.1.0 - beta
// =========================================
// ResponsiveFonts
// =========================================
// Config
$base-width:960 !default; // Width @ 100% layout or 1:1
$min-width:320 !default; // Minimum width
$max-width:2560 !default; // Maximum width
// only run once
ZSH=$HOME/.oh-my-zsh
ZSH_THEME="muse"
alias zshconfig="st $HOME/.zshrc"
COMPLETION_WAITING_DOTS="true"
plugins=(git git-extras osx sublime)
export PATH=/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin:$PATH
export PATH=$HOME/.macports/bin:$HOME/.macports/sbin:$PATH
@rjz
rjz / cs-jq-plugin-template.coffee
Created September 3, 2012 17:01
Coffeescript jQuery Plugin Class Template
# A class-based template for jQuery plugins in Coffeescript
#
# $('.target').myPlugin({ paramA: 'not-foo' });
# $('.target').myPlugin('myMethod', 'Hello, world');
#
# Check out Alan Hogan's original jQuery plugin template:
# https://github.com/alanhogan/Coffeescript-jQuery-Plugin-Template
#
(($, window) ->
@ahmednuaman
ahmednuaman / title_case.php
Created October 19, 2011 09:57
Convert strings to title case
function title_case($string, $delimiters = array(" ", "-", "O'"), $exceptions = array("to", "a", "the", "of", "by", "and", "with", 'it', 'as', "for")) {
/*
* Exceptions in lower case are words you don't want converted
* Exceptions all in upper case are any words you don't want converted to title case
* but should be converted to upper case, e.g.:
* king henry viii or king henry Viii should be King Henry VIII
*/
foreach ($delimiters as $delimiter){
$words = explode($delimiter, $string);
$newwords = array();