Skip to content

Instantly share code, notes, and snippets.

View xcv58's full-sized avatar
😀
What's happening?

xcv58 xcv58

😀
What's happening?
View GitHub Profile
@xcv58
xcv58 / copy-phab-title.js
Last active August 5, 2021 17:36
copy phab title with rich text
const copySelectedPhabs = () => {
let selection = window.getSelection();
if (selection.rangeCount <= 0) {
return
}
const div = document.createElement('div')
Array.from(document.querySelectorAll('.phui-oi-frame'))
.filter(el => selection.containsNode(el, true))
.forEach(el => {
const tmp = el.cloneNode(true)
@vktr
vktr / rule.js
Created February 10, 2018 18:54
Add Stripe Customer Id to Auth0 via custom rule
function (user, context, callback) {
user.app_metadata = user.app_metadata || {};
if ('stripe_customer_id' in user.app_metadata) {
context.idToken['https://example.com/stripe_customer_id'] = user.app_metadata.stripe_customer_id;
return callback(null, user, context);
}
var stripe = require('stripe')('sk_....');
var customer = {
@vonovak
vonovak / FlowTypedMobxInject.js
Last active June 15, 2019 23:47
using flowtype with @Inject from 'mobx-react'
import type File from "File";
import type FileService from "FileService";
type FileDetailProps = {
file: File
};
class FileDetail extends React.Component<FileDetailProps> {
render() {
// remove the file prop and flow will complain!
@Atinux
Atinux / async-foreach.js
Last active October 10, 2023 03:04
JavaScript: async/await with forEach()
const waitFor = (ms) => new Promise(r => setTimeout(r, ms))
const asyncForEach = async (array, callback) => {
for (let index = 0; index < array.length; index++) {
await callback(array[index], index, array)
}
}
const start = async () => {
await asyncForEach([1, 2, 3], async (num) => {
await waitFor(50)
atom.commands.add 'atom-text-editor', 'markdown:paste-as-link', ->
return unless editor = atom.workspace.getActiveTextEditor()
selection = editor.getLastSelection()
clipboardText = atom.clipboard.read()
selection.insertText("[#{selection.getText()}](#{clipboardText})")
atom.commands.add 'atom-text-editor',
'editor:toggle-current-row-folding': (event) ->
@staltz
staltz / introrx.md
Last active July 6, 2024 08:47
The introduction to Reactive Programming you've been missing
@gurupras
gurupras / compile.sh
Last active August 29, 2015 13:56
script to build os/161 source code
#!/bin/bash
#Each statement here is a blocking call, so we don't need explicit sleeping
#Our trusty local variables
ASST=ASST0
INVOKE_PATH=
BASE_PATH=
#how2use
@iainconnor
iainconnor / Android Studio .gitignore
Created January 24, 2014 20:20
A .gitignore for use in Android Studio
# Built application files
/*/build/
# Crashlytics configuations
com_crashlytics_export_strings.xml
# Local configuration file (sdk path, etc)
local.properties
# Gradle generated files
@tualatrix
tualatrix / download_picasa_photos_and_upload_to_flickr.sh
Created January 8, 2014 14:29
Download photos from Google Picasa and upload to Flickr, the album name will be read from album_list.txt
#!/bin/bash
while read album
do
echo -e "Will download album $album"
google picasa get "$album" .
pushd "$album"
echo -e "Start to upload $album to Flickr"
find -type f|sort|xargs -I{} flickr_upload {}
popd
@ymasory
ymasory / emacs-whitespace-long-lines.md
Created September 27, 2012 15:44
configuring emacs to show whitespace and long line problems

Configuring emacs for long line & whitespace detection

Goals

For a few years now I've been trying to get emacs to alert me, somehow, to:

  • lines longer than 80 characters
  • literal tabs (\t)
  • carriage returns (\r)
  • trailing whitespace at the end of a line ([ ]+$)

I've tried many strategies, but usually the result was something I found a little too intrusive, or difficult to manage.