Skip to content

Instantly share code, notes, and snippets.

View Strajk's full-sized avatar
🐣
knock knock…

Pavel 'Strajk' Dolecek Strajk

🐣
knock knock…
View GitHub Profile
@froots
froots / Car.js
Last active June 6, 2018 23:27
Stubbing module dependencies in ES2015 unit tests using Sinon.js or TestDouble.js.
// in /src directory
import {kphToMph} from './convert';
class Car {
constructor(speed) {
this.speed = speed;
}
getSpeedInMph() {
@sibelius
sibelius / Codemod RN24 to RN25.md
Last active November 9, 2016 13:09
Codemod React Native 24 imports to RN25 imports

README

Why this transform is necessary?

Until React Native 24, you import React from 'react-native' package, but this will change on RN 25, you will need to import React from 'react'. You probably have many files that does this, so I've created a codemod to save you a bunch of time

How to use this

  • Install jscodeshif
@bezhermoso
bezhermoso / notification-actions.applescript
Last active February 11, 2023 09:54
Handly AppleScripts to manage OS X notifications. (Use in Automator, bind to keyboard shortcuts via BetterTouchTool, etc.) Inspired by http://apple.stackexchange.com/a/155736
# Close all notifications
my closeNotifications()
on closeNotifications()
tell application "System Events" to tell process "Notification Center"
set theWindows to every window
repeat with i from 1 to number of items in theWindows
set this_item to item i of theWindows
try
click button 1 of this_item
@prasadsilva
prasadsilva / fresh-chrome-with-custom-tz.sh
Last active June 4, 2023 12:54 — forked from stuartsierra/fresh-chrome.sh
Launch new instances of Google Chrome on OS X with isolated cache, cookies, user config and custom Timezone
#!/usr/bin/env bash
# fresh-chrome
#
# Use this script on OS X to launch a new instance of Google Chrome
# with its own empty cache, cookies, and user configuration.
#
# The first time you run this script, it will launch a new Google
# Chrome instance with a permanent user-data directory, which you can
# customize below. Perform any initial setup you want to keep on every
// I'll have a entry point for the server app, like server.js,
// and and entry for the client app, like client.js
// in server.js I do this:
IS_CLIENT = false;
// in client.js I do this:
IS_CLIENT = true;
// Then anywhere in your code you can do this:
var React = require('react');
var $ = require('jquery');
require('jquery-ui');
var Dialog = React.createClass({
componentDidMount: function() {
this.portalNode = this.getDOMNode();
this.$portal = $(this.portalNode);
this.$portal.dialog({
autoOpen: false,
var Thing = React.createClass({
render () {
return (
<div>
{stuff.map(thing => ( // <-- use ( not {
<OtherThing thing={thing}/>
))}
</div>
);
}
@vegasje
vegasje / usability.md
Last active March 9, 2020 19:30
PLEASE DO NOT USE THIS. See http://userium.com/ instead.

PLEASE DO NOT USE THIS. See http://userium.com/ instead.

Usability Checklist

User Experience

  • Personalized features. Currency, language, country specific deals, taxes, or delivery options are changed based on user's location.
  • Registering provides value to users. For example a "Free Trial" button communicates a clear benefit, but a "Register" button doesn't. Unnecessary registration is avoided.
@adamcooke
adamcooke / cloudapp-export.rb
Created January 11, 2013 15:45
Export all your drops from CloudApp using this quick Ruby script
#!/usr/bin/env ruby
# A quick script to download all your files from CloudApp.
# To run this just run the script passing your e-mail & password
# to the script, for example:
#
# gem install cloudapp_api
# ruby cloudapp-export.rb adam@atechmedia.com mypassword
#
@andphe
andphe / gist:3232343
Created August 2, 2012 01:41
Export your links from Safari reading list
/usr/bin/plutil -convert xml1 -o - ~/Library/Safari/Bookmarks.plist | grep -E -o '<string>http[s]{0,1}://.*</string>' | grep -v icloud | sed -E 's/<\/{0,1}string>//g'