Skip to content

Instantly share code, notes, and snippets.

View yattias's full-sized avatar

Kobe Attias yattias

View GitHub Profile
@yomotsu
yomotsu / gulpfile.js
Last active September 17, 2017 18:54
webpack2 /w gulp
'use strict';
const browserSync = require( 'browser-sync' ).create();
const gulp = require( 'gulp' );
const gulpif = require( 'gulp-if' );
const rename = require( 'gulp-rename' );
const uglify = require( 'gulp-uglify' );
const webpack = require( 'webpack' );
@markerikson
markerikson / react-controlled-inputs.md
Last active June 15, 2021 12:50
React "controlled" vs "uncontrolled" inputs explanation

[12:03 AM] acemarke: "controlled" and "uncontrolled" inputs
[12:04 AM] acemarke: if I have a plain, normal HTML page, and I put <input id="myTextbox" type="text" /> in my page(edited)
[12:04 AM] acemarke: and I start typing into that textbox
[12:04 AM] acemarke: it remembers what I've typed. The browser stores the current value for that input
[12:05 AM] acemarke: and then sometime later, I can get the actual element, say, const input = document.getElementById("myTextbox"), and I can ask it for its value: const currentText = input.value;
[12:05 AM] acemarke: good so far?
[12:08 AM] acemarke: I'll keep going, and let me know if you have questions
[12:08 AM] lozio: ok, actually I'm reading
[12:09 AM] lozio: good
[12:09 AM] acemarke: so, a normal HTML input field effectively stores its own value at all times, and you can get the element and ask for its value

@wesbos
wesbos / tab-trigger.js
Created November 16, 2015 19:33
How to properly get a TAB trigger working with Emmet inside of JSX
{
"keys": ["tab"],
"command": "expand_abbreviation_by_tab",
// put comma-separated syntax selectors for which
// you want to expandEmmet abbreviations into "operand" key
// instead of SCOPE_SELECTOR.
// Examples: source.js, text.html - source
"context": [
{
@JonCole
JonCole / DiagnoseRedisErrors-ClientSide.md
Last active January 6, 2020 17:52
Diagnosing Redis errors caused by issues on the client side
@rlandas
rlandas / gulpinstall.sh
Created August 21, 2015 06:02
GULP : Uninstalling and Installing GULP global and local
npm uninstall -g gulp
npm install -g gulp
npm uninstall --save-dev gulp
npm install --save-dev gulp
@cdlewis
cdlewis / iterable.md
Last active May 8, 2024 18:07
Handlebars for Iterable

Chris' Iterable Handlebars Cheat Sheet

Merge Parameters

Iterable merge paremeters have different brackets depending on whether it's a user object or a feed. These differences extend to functions operating on those parameters. For example, {{if}} needs to be [[if]] when evaluating a feed parameter.

User object

{{firstName}}
@sebmarkbage
sebmarkbage / Enhance.js
Last active January 31, 2024 18:33
Higher-order Components
import { Component } from "React";
export var Enhance = ComposedComponent => class extends Component {
constructor() {
this.state = { data: null };
}
componentDidMount() {
this.setState({ data: 'Hello' });
}
render() {
@wearhere
wearhere / rewrite_CSP_header.js
Created December 17, 2014 04:36
How to rewrite the 'content-security-policy' HTTP header to work around bugs in the Chrome extension APIs: https://www.mixmax.com/blog/what-to-do-when-your-app-breaks
var hosts = 'https://d1j5o6e2vipffp.cloudfront.net';
var iframeHosts = 'https://app.mixmax.com';
chrome.webRequest.onHeadersReceived.addListener(function(details) {
for (var i = 0; i &lt; details.responseHeaders.length; i++) {
var isCSPHeader = /content-security-policy/i.test(details.responseHeaders[i].name);
if (isCSPHeader) {
var csp = details.responseHeaders[i].value;
csp = csp.replace('script-src', 'script-src ' + hosts);
csp = csp.replace('style-src', 'style-src ' + hosts);
@roachhd
roachhd / README.md
Last active May 28, 2024 19:16
EMOJI cheatsheet 😛😳😗😓🙉😸🙈🙊😽💀💢💥✨💏👫👄👃👀👛👛🗼🔮🔮🎄🎅👻

EMOJI CHEAT SHEET

Emoji emoticons listed on this page are supported on Campfire, GitHub, Basecamp, Redbooth, Trac, Flowdock, Sprint.ly, Kandan, Textbox.io, Kippt, Redmine, JabbR, Trello, Hall, plug.dj, Qiita, Zendesk, Ruby China, Grove, Idobata, NodeBB Forums, Slack, Streamup, OrganisedMinds, Hackpad, Cryptbin, Kato, Reportedly, Cheerful Ghost, IRCCloud, Dashcube, MyVideoGameList, Subrosa, Sococo, Quip, And Bang, Bonusly, Discourse, Ello, and Twemoji Awesome. However some of the emoji codes are not super easy to remember, so here is a little cheat sheet. ✈ Got flash enabled? Click the emoji code and it will be copied to your clipboard.

People

:bowtie: 😄

@tobiashm
tobiashm / appcache.rake
Created January 2, 2014 08:53
Rake task to generate appcache manifest for Rails assets
namespace :appcache do
desc "Create manifest"
task :create do
sprockets_manifest = Rails.root.join("public/assets/manifest.yml")
abort "#{sprockets_manifest} not found" unless sprockets_manifest.exist?
prefix = Rails.configuration.assets.prefix
files = YAML.load(sprockets_manifest.open).map { |_, file| "#{prefix}/#{file}" }
Rails.root.join("public/manifest.appcache").open("w") do |out|
out << "CACHE MANIFEST\n\n"
out << "# " << `git rev-parse HEAD` << "\n"