Skip to content

Instantly share code, notes, and snippets.

@miklschmidt
miklschmidt / rn-cli.config.js
Created September 22, 2016 14:13
React Native typescript configuration
var path = require('path');
module.exports = {
getAssetExts() {
return [
'ts',
'tsx'
]
},
getTransformModulePath() {
return path.join(__dirname, 'transformer.js');
@miklschmidt
miklschmidt / request-tracker.jsx
Last active August 29, 2015 14:22
Flux and request tracking: part 2
class RequestTracker extends React.Component {
static propTypes = {
requestId: React.PropTypes.number.isRequired,
success: React.PropTypes.func,
fail: React.PropTypes.func,
always: React.PropTypes.func
}
constructor(props) {
@miklschmidt
miklschmidt / some-component.jsx
Last active August 29, 2015 14:22
Flux and request tracking: part 1
class SomeComponent extends React.Component {
getInitialState() {
return {
requestId: null
}
}
createArticleSuccess() {
// Do stuff on success..
define [
# Libs
chaplin
underscore
jquery
# Models
modules/somewidget/models/mymodel
modules/somewidget/models/anothermodel
# Views
modules/somewidget/views/test
@miklschmidt
miklschmidt / server.coffee
Created July 1, 2013 18:42
Scripts for making autoupdates in node-webkit for Linux and Windows. This is a very early work in progress, more like a proof of concept. TODO: Add OS X support. Check for and notify about filelocks. Use a real db. Abstract out update logic into strategies (node-webkit, assets, updater). Use semver for version handling. Changelogs in Markdown. P…
fs = require('fs')
http = require('http')
https = require('https')
express = require('express')
path = require 'path'
_ = require('underscore')
sessionToken = "secretString"
secretUploadPass = "Change me"
secretPass = "Change me too"
@miklschmidt
miklschmidt / notifications.coffee
Last active July 13, 2017 06:11
Take at notifications for node-webkit with a shitload of dependencies (Require.js, chaplin, TWEEN.js and so on).. sorry for that.
define [
'jquery'
'underscore'
'backbone'
'lib/gui'
'models/notification'
'views/notification'
'vendor/tween'
'jquery-ui'
<?php
$css = $_GET['path'];
$less = str_replace(".css",".less",$css);
file_exists($less) and $compiled_css = str_replace(".css", filemtime($less) . ".css", $_GET['path']);
if (!empty($compiled_css) and !file_exists($compiled_css))
{
header("Content-type: text/css");
$less_command = "/var/www/node/node_modules/less/bin/lessc ".realpath($less)." ".realpath($compiled_css);
shell_exec($less_command);