Skip to content

Instantly share code, notes, and snippets.

View ckahle33's full-sized avatar
🏠
Working from home

Craig Kahle ckahle33

🏠
Working from home
  • Meow Wolf
  • Taos, NM
View GitHub Profile
@ckahle33
ckahle33 / gist:74f12a96699faf33b32b
Last active August 29, 2015 14:24
Store number of char occurrences in a string
function countLetters(string) {
var splitString = string.split('');
var store = {};
splitString.forEach(function(val, index){
if (val in store && val !== ' ') {
store[val]++;
} else {
store[val] = 1;
@ckahle33
ckahle33 / gist:f0feb8becea1b995a924
Created September 30, 2014 20:57
Background image shorthand recipe
//simple but handy!!
background: #3b5998 url("/img/facebookIcon.png") no-repeat 93% 12px/17.5px 35px;
$("#taskSortable").children();
var patchList = [];
taskList.each(function(){
var $this = $(this);
var item = { resource_uri : "/api/task-adventure/"+$this.attr("id")+"/",
order : $this.index()}
patchList.push(item);
});
$.ajax({
type: "get",
// url: window.mlg_api_url + "session/?series__pro__id="+ window.pro.id +"&limit=1&format=json",
url: window.mlg_api_url + "session/?series__pro__id="+ window.pro.id +"&limit=1"+ "&series__startDate__gte=" + moment().format('YYYY-MM-DD[T]hh:mm:ss') + "&format=json",
dataType: 'json',
accepts: 'Application/json',
contentType: "application/json",
headers: {"x-mlg-api" : "apikey " + window.mlg_api_hash },
crossDomain: 'true',
success: function( json ) {
window.sessions = json;
for (var i = 0; i < window.sessions.objects.length; i++) {
window.events = [];
window.events.push({
start: window.sessions.objects[i].startDateTime,
function mlgGetCoreList () {
var cores = '';
$.ajax({
type: "GET",
url: 'http://qa.mylittlegolfer.com/prolibapi/v1/core/?format=json',
dataType: "json",
// data: {
// action: "mlg_get_core_list",
<?php
/*
* Craig Kahle 2014
* Crispy Interactive
*/
$MLG_API_URL = "http://qa.mylittlegolfer.com";
<?php
### This would go in the English ./index.php
// If browser language is Turkish or if there is a cookie saying you prefer
// the Turkish version, we will redirect you to /tr/.
if (strpos($_SERVER['HTTP_ACCEPT_LANGUAGE'], 'tr') || (isset($_COOKIE['winmation-lang']) && $_COOKIE['winmation-lang'] === 'tr')) {
setcookie("winmation-lang", 'tr', time()+3600*24*365*10); //expire in 10 years
// header('Location: http://www.winmation-tr.com/tr/');
}
// If you got to the English version by clicking 'english' from
$(function(){
//initialize valiadation
$(".private").validationEngine();
$(".private input").focus(function(){
$(this).validationEngine('hide');
})