Skip to content

Instantly share code, notes, and snippets.

View pitkane's full-sized avatar

Mikko Kohtala pitkane

View GitHub Profile
<?php
require_once('workflows.php');
$w = new Workflows();
// $query = ltrim($argv[1]);
// $parts = explode(' ', $query);
// echo "\n\n New Run \n\n";
@pitkane
pitkane / init.coffee
Last active January 27, 2016 12:33 — forked from Zequez/init.coffee
Comment out JSX code on Atom
# If you worked with React and JSX you probably noticed that you can't use JS comments when inside JSX sections
# Add this to your Atom init script
# Then add 'ctrl-cmd-/': 'comment-jsx' to your keymap.cson
# Then when you are on a JS/JSX file, just press cmd+ctrl+/ to use JSX-style comments that work with JSX elements
# Is not the most efficient way, but it's the cleanest and reliable one
# FORK UPDATE 27.1.2016:
# Overwriting "Toggle Comments" function:
# '.workspace .editor:not(.mini)':
# 'cmd-/': 'comment-jsx'
// Most of the time you can do data loading in react-router's onEnter/onLeave hooks, which support async operations. If you're using Redux or some other flux implementation, you can dispatch a loading() action, perform your data fetching, and then dispatch a loaded() action once the data's ready.
function fetchData(nextState, replace, done) {
store.dispatch(loading());
doAsyncThing().then(() => {
store.dispatch(loaded());
done();
});
}
jQuery.ready({ DOM:true }, function($) {
$("li[class^='tab-'].unselected").each(function() {
if( $(this).find('span').length > 0 ) {
if( $(this).find('span > a').length == 0 ) {
$(this).addClass('HideElement');
}
};
});
$("li[id^='Tab-'].unselected").each(function() {
jQuery(window).load(function() {
// käydään kaikki youtube-kikkareet läpi, ja luodaan thumbnail
jQuery('div.epgadget-externalvideo').each(function() {
jQuery(this).after('<div class="Thumb"></div>');
var iframe = jQuery(this).find('iframe');
var iframe_src = iframe.attr('src');
var youtube_video_id = iframe_src.match(/youtube\.com.*(\?v=|\/embed\/)(.{11})/).pop();
use strict;
use warnings;
use Getopt::Long;
use DE_EPAGES::Core::API::Script qw(RunScript);
use DE_EPAGES::Database::API::Connection qw(RunOnStore);
use DE_EPAGES::Object::API::Factory qw(LoadObject LoadObjectByPath ExistsObject ExistsObjectByGUID LoadRootObject LoadObjectByGUID ExistsObjectByPath LoadClassByAlias );
use DE_EPAGES::Core::API::Error qw(ExistsError GetError);
use DE_EPAGES::Core::API::Log qw (GetLog LogDebug);
use DE_EPAGES::WebInterface::API::MessageCenter qw( SynchronizeCache );
const express = require('express');
const router = express.Router();
const path = require('path');
const chalk = require('chalk');
const Git = require('nodegit');
const walk = require('walk');
const fs = require('fs');
const rimraf = require('rimraf');
const _ = require('lodash');
const log = console.log;
<!-- basket ajax -->
<script type="text/javascript">
/*
jQuery.ready(function($) {
jQuery("#basketForm_standalone").submit(function(e) {
var cart = jQuery('.Header .BasketBox');
/* var cart2 = jQuery('.NavBarRoof .BasketBox');
cart = cart2.height() ? cart2 : cart1; */
var imgtodrag = jQuery('#ProductSlideshow img');
@pitkane
pitkane / async-await.js
Created February 23, 2017 20:53 — forked from wesbos/async-await.js
Simple Async/Await Example
// 🔥 Node 7.6 has async/await! Here is a quick run down on how async/await works
const axios = require('axios'); // promised based requests - like fetch()
function getCoffee() {
return new Promise(resolve => {
setTimeout(() => resolve('☕'), 2000); // it takes 2 seconds to make coffee
});
}
{
"extends": [
"@frontend/coinbase",
"prettier",
"prettier/react",
"prettier/flowtype"
],
"rules": {
"flowtype/type-id-match": [
2,