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
@ckirkendall
ckirkendall / clojure-match.clj
Created June 15, 2012 02:26 — forked from bkyrlach/Expression.fs
Language Compare F#, Ocaml, Scala, Clojure, Ruby and Haskell - Simple AST example
(use '[clojure.core.match :only [match]])
(defn evaluate [env [sym x y]]
(match [sym]
['Number] x
['Add] (+ (evaluate env x) (evaluate env y))
['Multiply] (* (evaluate env x) (evaluate env y))
['Variable] (env x)))
(def environment {"a" 3, "b" 4, "c" 5})
@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.

@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
@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
@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
@staltz
staltz / introrx.md
Last active July 6, 2024 08:47
The introduction to Reactive Programming you've been missing
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) ->
@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)
@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!
@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 = {