Skip to content

Instantly share code, notes, and snippets.

View Fallenstedt's full-sized avatar
:octocat:
Having fun

Alexander Fallenstedt Fallenstedt

:octocat:
Having fun
View GitHub Profile
@rikukissa
rikukissa / README.md
Last active March 31, 2017 20:15
How to install React Native tvOS example with Xcode 7.3.1

1. Clone repository, install dependencies & start the development server

git clone git@github.com:deanmcpherson/react-native-tvos-example.git
cd react-native-tvos-example
npm install
npm start

Open ios/townskTV.xcodeproj in Xcode

@Fallenstedt
Fallenstedt / EmittingComponent.js
Created April 6, 2017 03:43 — forked from puranjayjain/EmittingComponent.js
Using fbemitter-https://github.com/facebook/emitter/ (An event emitter) with React + ES6
import React from 'react'
import mrEmitter from '../helpers/mrEmitter'
export default class EmittingComponent extends React.Component {
handleClick = () => {
mrEmitter.emit('onSomeEvent', 'foo sends bar')
}
render() {
defmodule Image do
defstruct [:grid, :pixel_map]
end
defmodule RandomImageGenerator do
def create(width, bar_size, filename \\ "out.png") do
%Image{}
|> create_grid(width)
|> build_pixel_map(width, bar_size)
@DimsumPanda
DimsumPanda / index.html
Created July 30, 2016 09:59
Stacked Bar Charts D3 v4
<!DOCTYPE html>
<meta charset="utf-8">
<style>
.bar {
fill: steelblue;
}
.axis path {
/*display: none;*/
@jjmu15
jjmu15 / has_class.js
Created January 27, 2014 10:08
has class function - vanilla JS. Check if element has specified class
// hasClass, takes two params: element and classname
function hasClass(el, cls) {
return el.className && new RegExp("(\\s|^)" + cls + "(\\s|$)").test(el.className);
}
/* use like below */
// Check if an element has class "foo"
if (hasClass(element, "foo")) {
@phuochau
phuochau / sample_configuration.js
Last active March 26, 2018 17:46
Sample configuration for using Jest and vue-test-utils in nuxt.js project
// package.json
"jest": {
"roots": [
"<rootDir>/tests/unit"
],
"moduleNameMapper": {
"[\\s\\S]*.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$": "<rootDir>/tests/unit/__mocks__/fileMock.js",
"[\\s\\S]*.(css|less)$": "<rootDir>/tests/unit/__mocks__/styleMock.js",
"~/([a-zA-Z0-9/.\\-_]*)": "<rootDir>/src/$1"
@josevalim
josevalim / sample output
Created May 24, 2012 17:53 — forked from alco/sample output
Updated Elixir chat demo
defmodule Chat.Client do
# In all of the following functions 'server' stands for the server's pid
def join(server) do
send server, :join
end
def say(server, message) do
send server, { :say, message }
end
@DTailor
DTailor / backup_restore.sh
Last active September 15, 2019 18:13
Backup/Restore PostgreSQL Database
# List all databases
sudo -u postgres psql --list
# Create backup file
sudo -u postgres pg_dump [database_name] > dumpl.sql
# Drop the database
sudo -u prostgres dropdb [database_name]
# Create a new database
@Fallenstedt
Fallenstedt / keybase.md
Created June 9, 2020 04:04
keybase.md

Keybase proof

I hereby claim:

  • I am fallenstedt on github.
  • I am fallenstedt (https://keybase.io/fallenstedt) on keybase.
  • I have a public key ASC9XKEzj4DsJZDXNeszL8jAlaLxCHhC1esNgTCRlTXaUQo

To claim this, I am signing this object:

@brien-crean
brien-crean / twitter_oauth_user_context.js
Created July 14, 2017 18:22
Twitter 3 legged OAuth on AWS Lambda with NodeJS
const OAuth = require('oauth');
const Twit = require('twit');
const nconf = require('nconf');
// temp global var
var oAuthTokenSecret;
// load config file which contains twitter app tokens
nconf.file({ file: './config/twitter-share.json' }).env()