Skip to content

Instantly share code, notes, and snippets.

Jamis Charles jamischarles

  • PayPal
  • near Boulder, CO
Block or report user

Report or block jamischarles

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@jamischarles
jamischarles / curry.js
Last active Sep 24, 2015
A simple example of currying in JS
View curry.js
// This is a 'curried' function. If it receives less params than it expects, it returns a function which expects the rest of the params.
function add(a, b) {
// if 2nd param wasn't passed, return a function that holds the 1st param via closure, but expects another param.
if (typeof b === "undefined") {
return function(c) {
a + c;
}
}
// if 2 params are passed return the result
@jamischarles
jamischarles / gitmove_several.sh
Last active Aug 29, 2015
Move Several git files over to a new repo with history. Very optimistic about errors
View gitmove_several.sh
#!/bin/bash
# $ ./gitmove [destGitRepo] [src_file]
DEST_FOLDER=$1
# this will take all parameters AFTER the first. So you can give a list, or a glob (which is expanded into separate params)
SOURCE_FILES="${@:2}"
# SOURCE_FILE=$2
STARTING_FOLDER=$(pwd)
@jamischarles
jamischarles / gitmove.sh
Last active Feb 21, 2019
Git move - Move file to new repo and preserve history
View gitmove.sh
#!/bin/bash
# $ ./gitmove [destGitRepo] [src_file]
DEST_FOLDER=$1
SOURCE_FILE=$2
# get the earliest hash of a source file to copy
HASH=$(git log --format=%H $SOURCE_FILE | tail -1)
# echo $HASH
View copy-git-file.sh
#!/bin/bash
#Inspired by http://blog.neutrino.es/2012/git-copy-a-file-or-directory-from-another-repository-preserving-history/
#Copy a file or directory out of a git repository, preserving history!
#Creates DESTINATIONPATH with patches that can be applied with git am
#e.g.
#0001-Add-new-theme-Gum.patch
#0002-Add-syntax-highlighting-for-Gum-theme.patch
#0003-Gum-Fix-tag-URLs-not-being-slugified-and-therefore-b.patch
#0004-Gum-Add-Disqus-support.patch
#0005-Gum-Use-article-title-as-the-title-of-the-generated-.patch
View git_commands.sh
- my normal flow?
- good commit messages ******
- searching commit messages (group by keywords)
- searching code *
- working with history (viewing, time traveling)
- rebasing (for pulling & squashing, splitting a commit) *
- undoing local commits (soft, hard reset)
- forgot to add / change message (amend)
- LOST commits? *
@jamischarles
jamischarles / css_center.css
Created Feb 4, 2015
CSS: Center horizontally and vertically
View css_center.css
/* Supported IE8+ */
.el {
display: table-row;
width: 100%;
}
View clearfix.css
/* (taken from bootstrap github conversation) */
/* Utility classes */
/* Clearfix */
/* Clearfix for modern browsers */
.cf:before,
.cf:after {
content: "";
display: table;
@jamischarles
jamischarles / sublime_shortcuts.markdown
Created Oct 10, 2012
Most useful Sublime Shortcuts
View sublime_shortcuts.markdown

Usefulness is indicated by amount of stars.

All are currently Mac only

Expand selection to tag **

Shift + Cmd + A

Wrap selection with tag **

Ctrl + Shift + W

View nodejs_express_file-structure.markdown

consider making a node-guides site like rails guides?

Approach 1:

TJ HollowayChuck (creator of Express)

"personally I find large rails-style structure difficult to work with for large applications (great for small ones however). A more modular approach like Drupal is a big win as far as management goes but it can complicate some things (layout templates) so you kind of need

@jamischarles
jamischarles / functions.php
Created Apr 25, 2012
Display links to WordPress blog posts on non-WP pages using the WordPress API.
View functions.php
//add this code at the end of "functions.php" (Theme Functions). This can be accessed through the WP admin menu under Appearance -> Editor -> Theme Functions
//this is the logic to get the posts you want
function displayHomePosts(){
//default values obj from post.php.
//pass these in as args that you really want
$defaults = array(
'numberposts' => 5, 'offset' => 0,
'category' => 0, 'orderby' => 'post_date',
You can’t perform that action at this time.